{"id":20900554,"url":"https://github.com/phpbench/cellular","last_synced_at":"2026-07-08T15:31:04.244Z","repository":{"id":32110901,"uuid":"35683259","full_name":"phpbench/cellular","owner":"phpbench","description":"OOP library for representing and analyzing tabular data","archived":false,"fork":false,"pushed_at":"2015-09-21T13:56:33.000Z","size":408,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-26T22:45:49.582Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phpbench.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-15T16:02:12.000Z","updated_at":"2016-08-09T16:51:46.000Z","dependencies_parsed_at":"2022-08-21T09:50:14.846Z","dependency_job_id":null,"html_url":"https://github.com/phpbench/cellular","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/phpbench/cellular","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpbench%2Fcellular","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpbench%2Fcellular/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpbench%2Fcellular/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpbench%2Fcellular/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpbench","download_url":"https://codeload.github.com/phpbench/cellular/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpbench%2Fcellular/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35270196,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-08T02:00:06.796Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T11:20:41.480Z","updated_at":"2026-07-08T15:31:04.225Z","avatar_url":"https://github.com/phpbench.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Cellular\n========\n\n**ABANDONED**: Use Tabular instead.\n\n[![Build Status](https://travis-ci.org/dantleech/cellular.svg?branch=master)](https://travis-ci.org/dantleech/cellular) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/dantleech/cellular/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/dantleech/cellular/?branch=master)\n\nThe cellular library provides an object oriented way of building, representing and analyzing tabular data.\n\nFeatures:\n\n- Supports aggregate functions `sum`, `avg`, `min`, `max` and `median`.\n- Aggreate functions can applied to `Table`, `Row` and `Column`.\n- Supports cell groups.\n- Callbacks can be applied to cells on whole, or selected groups of `Table`,\n  `Row` and `Column` instances.\n- Produce grouped tables with callbacks - analagous to `SELECT bar, SUM(foo) FROM sometable GROUP BY bar`\n- Fluent table builder\n\nNote that this library is under development.\n\nCreating\n--------\n\nCol 1 | Col 2 | Col 3\n----- | ----- | -----\n12    | 14    | 4\n12    | 14    | 4\n\nWould be created as follows:\n\n````php\n$table = Table::create();\n$table-\u003ecreateAndAddRow()\n    -\u003eset('col1', 12)\n    -\u003eset('col2', 14)\n    -\u003eset('col3', 4);\n$table-\u003ecreateAndAddRow()\n    -\u003eset('col1', 12)\n    -\u003eset('col2', 14)\n    -\u003eset('col3', 4)\n````\n\nOr without the builder:\n\n````php\n$table = new Table(\n     new Row(array(\n         'col1' =\u003e new Cell(12),\n         'col2' =\u003e new Cell(14),\n         'col3' =\u003e new Cell(4),\n     )),\n     new Row(array(\n         'col1' =\u003e new Cell(12),\n         'col2' =\u003e new Cell(14),\n         'col3' =\u003e new Cell(4),\n     )),\n );\n````\n\nRetrieving cell values\n----------------------\n\nYou can retrieve values from `Table`, `Row` and `Column` instances as follows:\n\n````php\n$table-\u003egetValues(); // return an array containg all cell values\n$table-\u003egetRow(0)-\u003egetValues();\n$table-\u003egetColumn('col1')-\u003egetValues();\n````\n\nGroups\n------\n\nYou apply groups to cells:\n\n````php\n$table-\u003ecreateAndAddRow()\n    -\u003eset('hello, 'vaue', array('group1'));\n\nvar_dump($table-\u003egetCells(array('group1'))); // dump all cells in group1\n\n$table-\u003emapValues(function ($value) {\n    return 'goodbye';\n}, array('group1')); // set the value of all cells in group1 to \"goodbye\"\n````\n\nUsing the Calculator\n--------------------\n\nThe calculator allows you to apply certain calculations to values, `Cell`\ninstances or any instance of `CellularInterface`:\n\n````php\n$mean = Calculator::mean($table); // return the mean (average) value of the table\n\n$median = Calculator::median($table-\u003egetRow(0)); // return the median value of the first row\n\n$deviation = Calculator::deviation(\n    Calculator::mean($table-\u003egetColumn('col1')),\n    $table-\u003egetRow(0)-\u003egetCell('col1')\n); // return the deviation of \"col1\" in the first row as a percentage from the average value of \"col1\"\n````\n\nCurrent functions:\n\n- `sum`: Return the sum of values\n- `min`: Return the minimum value\n- `max`: Return the maximum value\n- `mean`: Return the mean (average) value\n- `median`: Return the median value\n- `deviation`: Return the deviation as a percentage\n\nPartitioning and Forking\n------------------------\n\n`Table` and `Row` instances provide the following methods:\n\n- `partition`: Internally divide the collection of elements according to a\n  given callback.\n- `aggregate`: Aggregate the partitions of a table back to a single partition.\n\nThis is useful for creating summaries from multiple tables or rows:\n\nFor example:\n\n````php\n$table\n    -\u003epartition(function ($row) {\n        return $row['class'];\n    })\n    -\u003epartition(function ($table, $newInstance) use ($cols, \u0026$newCols, $options, $functions) {\n        $newInstance-\u003ecreateAndAddRow()\n            -\u003eset(\n                'number', \n                Calculator::sum($table-\u003egetColumn('number'))\n            );\n    });\n````\n\nThe callback is passed each partition in turn alongisde a new instance\nof the collection class. The callback's responsiblity is to add new rows to\nthe new instance, the primary partition of which will become the new primary\npartition for the collection upon which the operation is performed.\n\nThe result will be anagous to the following SQL: `SELECT SUM(number) FROM table GROUP BY class`.\n\nSorting\n-------\n\nSorting can be achieved as follows:\n\n````php\n$table-\u003esort(function ($row1, $row2) {\n    return $row1['col1'] \u003e $row2['col1'];\n});\n````\n\nEvaluating values\n-----------------\n\nValues can be evaluated as follows:\n\n````php\n$sum = $table-\u003eevaluate(function ($row, $lastValue) {\n    $lastValue += $row['cell']-\u003egetValue();\n}, 0); // evaluates the sum of the column \"cell\"\n````\n\nThe callback is passed the element and the previous result. The initial result\nis given as the second argument to `evaluate`.\n\nSetting Attributes\n------------------\n\nIt is possible to set attributes on `Cell` and `Cellular` instances. This is\nuseful when you need to store metadata about the source of the data before it\nwas transformed into cellular form.\n\n````php\n$table-\u003esetAttribute('foo', 'bar');\n$table-\u003egetAttribute('foo');\n$table-\u003ehasAttribute('foo');\n````\n\nOther methods\n-------------\n\n- `filter`: Filter the results by a closure. Returns a new instance.\n- `clear`: Clear the collection\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpbench%2Fcellular","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpbench%2Fcellular","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpbench%2Fcellular/lists"}