{"id":14035039,"url":"https://github.com/phplucidframe/console-table","last_synced_at":"2025-06-20T22:05:17.724Z","repository":{"id":48382442,"uuid":"50597616","full_name":"phplucidframe/console-table","owner":"phplucidframe","description":"ConsoleTable helps you to display tabular data in a terminal/shell/console","archived":false,"fork":false,"pushed_at":"2025-05-26T16:13:41.000Z","size":50,"stargazers_count":102,"open_issues_count":3,"forks_count":23,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-26T17:38:57.909Z","etag":null,"topics":["console-tool","php","php-framework","php-library","phplucidframe"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phplucidframe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-01-28T16:45:01.000Z","updated_at":"2025-05-26T16:14:22.000Z","dependencies_parsed_at":"2025-05-29T14:32:57.366Z","dependency_job_id":null,"html_url":"https://github.com/phplucidframe/console-table","commit_stats":{"total_commits":26,"total_committers":4,"mean_commits":6.5,"dds":"0.23076923076923073","last_synced_commit":"082e02ef2cd3c250dac3d9a9efd7fe22aeca88b2"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/phplucidframe/console-table","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phplucidframe%2Fconsole-table","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phplucidframe%2Fconsole-table/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phplucidframe%2Fconsole-table/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phplucidframe%2Fconsole-table/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phplucidframe","download_url":"https://codeload.github.com/phplucidframe/console-table/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phplucidframe%2Fconsole-table/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261025913,"owners_count":23099092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["console-tool","php","php-framework","php-library","phplucidframe"],"created_at":"2024-08-12T03:01:16.968Z","updated_at":"2025-06-20T22:05:12.712Z","avatar_url":"https://github.com/phplucidframe.png","language":"PHP","readme":"# PHP ConsoleTable\n\n**ConsoleTabe** makes you easy to build console style tables. It helps you to display tabular data in terminal/shell. This is a component of [PHPLucidFrame](https://github.com/phplucidframe/phplucidframe).\n\nLicense: [MIT](https://opensource.org/licenses/MIT)\n\n## Composer Installation\n\n    composer require phplucidframe/console-table\n\n## Example 1: Bordered Table (Default)\n\n    require 'src/LucidFrame/Console/ConsoleTable.php';\n\n    $table = new LucidFrame\\Console\\ConsoleTable();\n    $table\n        -\u003eaddHeader('Language')\n        -\u003eaddHeader('Year')\n        -\u003eaddRow()\n            -\u003eaddColumn('PHP')\n            -\u003eaddColumn(1994)\n        -\u003eaddRow()\n            -\u003eaddColumn('C++')\n            -\u003eaddColumn(1983)\n        -\u003eaddRow()\n            -\u003eaddColumn('C')\n            -\u003eaddColumn(1970)\n        -\u003edisplay()\n    ;\n\nYou can also print the table using `getTable` method such as `echo $table-\u003egetTable();`\n\n**Output**:\n\n    +----------+------+\n    | Language | Year |\n    +----------+------+\n    | PHP      | 1994 |\n    | C++      | 1983 |\n    | C        | 1970 |\n    +----------+------+\n\n## Example 2: Bordered Table with Padding Width 2\n\nYou can also use `setHeaders()` and `addRow` with Arrays.\n\n    require 'src/LucidFrame/Console/ConsoleTable.php';\n\n    $table = new LucidFrame\\Console\\ConsoleTable();\n    $table\n        -\u003esetHeaders(array('Language', 'Year'))\n        -\u003eaddRow(array('PHP', 1994))\n        -\u003eaddRow(array('C++', 1983))\n        -\u003eaddRow(array('C', 1970))\n        -\u003esetPadding(2)\n        -\u003edisplay()\n    ;\n\n**Output**:\n\n    +------------+--------+\n    |  Language  |  Year  |\n    +------------+--------+\n    |  PHP       |  1994  |\n    |  C++       |  1983  |\n    |  C         |  1970  |\n    +------------+--------+\n\n## Example 3: Bordered Table with Left Margin Width 4\n\n    require 'src/LucidFrame/Console/ConsoleTable.php';\n\n    $table = new LucidFrame\\Console\\ConsoleTable();\n    $table\n        -\u003esetHeaders(array('Language', 'Year'))\n        -\u003eaddRow(array('PHP', 1994))\n        -\u003eaddRow(array('C++', 1983))\n        -\u003eaddRow(array('C', 1970))\n        -\u003esetIndent(4)\n        -\u003edisplay()\n    ;\n\n**Output**:\n\n        +----------+------+\n        | Language | Year |\n        +----------+------+\n        | PHP      | 1994 |\n        | C++      | 1983 |\n        | C        | 1970 |\n        +----------+------+\n\n## Example 4: Non-bordered Table with Header\n\n    require 'src/LucidFrame/Console/ConsoleTable.php';\n\n    $table = new LucidFrame\\Console\\ConsoleTable();\n    $table\n        -\u003esetHeaders(array('Language', 'Year'))\n        -\u003eaddRow(array('PHP', 1994))\n        -\u003eaddRow(array('C++', 1983))\n        -\u003eaddRow(array('C', 1970))\n        -\u003ehideBorder()\n        -\u003edisplay()\n    ;\n\n**Output**:\n\n     Language  Year\n    ----------------\n     PHP       1994\n     C++       1983\n     C         1970\n\n## Example 5: Non-bordered Table without Header\n\n    require 'src/LucidFrame/Console/ConsoleTable.php';\n\n    $table = new LucidFrame\\Console\\ConsoleTable();\n    $table\n        -\u003eaddRow(array('PHP', 1994))\n        -\u003eaddRow(array('C++', 1983))\n        -\u003eaddRow(array('C', 1970))\n        -\u003ehideBorder()\n        -\u003edisplay()\n    ;\n\n**Output**:\n\n     PHP  1994\n     C++  1983\n     C    1970\n\n## Example 6: Table with all borders\n\n    require 'src/LucidFrame/Console/ConsoleTable.php';\n\n    $table = new LucidFrame\\Console\\ConsoleTable();\n    $table\n        -\u003esetHeaders(array('Language', 'Year'))\n        -\u003eaddRow(array('PHP', 1994))\n        -\u003eaddRow(array('C++', 1983))\n        -\u003eaddRow(array('C', 1970))\n        -\u003eshowAllBorders()\n        -\u003edisplay()\n    ;\n\nAlternatively, you can use `addBorderLine()` for each row.\n\n    $table\n        -\u003esetHeaders(array('Language', 'Year'))\n        -\u003eaddRow(array('PHP', 1994))\n        -\u003eaddBorderLine()\n        -\u003eaddRow(array('C++', 1983))\n        -\u003eaddBorderLine()\n        -\u003eaddRow(array('C', 1970))\n        -\u003edisplay()\n    ;\n\n**Output**\n\n    +----------+------+\n    | Language | Year |\n    +----------+------+\n    | PHP      | 1994 |\n    +----------+------+\n    | C++      | 1983 |\n    +----------+------+\n    | C        | 1970 |\n    +----------+------+\n\n## Test\n\nIf you have [PHPUnit](https://phpunit.de/manual/current/en/installation.html) installed in your machine, you can run test at your project root. \n\n    composer install\n    phpunit tests\n\nIf you don't have PHPUnit, you can simply run this in your terminal.\n\n    php example.php\n","funding_links":[],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphplucidframe%2Fconsole-table","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphplucidframe%2Fconsole-table","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphplucidframe%2Fconsole-table/lists"}