{"id":15292292,"url":"https://github.com/wpbones/wptables","last_synced_at":"2025-04-13T10:31:15.370Z","repository":{"id":57082144,"uuid":"77465570","full_name":"wpbones/wptables","owner":"wpbones","description":"WP Tables fluent implementation for WP Bones","archived":false,"fork":false,"pushed_at":"2024-10-24T16:40:09.000Z","size":20,"stargazers_count":3,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-25T23:35:38.323Z","etag":null,"topics":["wordpress","wordpress-development","wp-bones","wp-bones-packages","wp-tables"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wpbones.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2016-12-27T15:39:00.000Z","updated_at":"2024-10-24T16:40:14.000Z","dependencies_parsed_at":"2024-10-24T20:57:07.834Z","dependency_job_id":"3e1c5870-55b3-4c6d-a684-33cde9778d39","html_url":"https://github.com/wpbones/wptables","commit_stats":{"total_commits":9,"total_committers":4,"mean_commits":2.25,"dds":"0.33333333333333337","last_synced_commit":"928cfe34dfaa7d62261e2e7239a9c0d4a5b2a9f4"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpbones%2Fwptables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpbones%2Fwptables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpbones%2Fwptables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpbones%2Fwptables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wpbones","download_url":"https://codeload.github.com/wpbones/wptables/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223581935,"owners_count":17168655,"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":["wordpress","wordpress-development","wp-bones","wp-bones-packages","wp-tables"],"created_at":"2024-09-30T16:17:17.192Z","updated_at":"2024-11-07T20:06:26.147Z","avatar_url":"https://github.com/wpbones.png","language":"PHP","readme":"# WP Tables for WP Bones\n\n\u003cdiv align=\"center\"\u003e\n\n[![Latest Stable Version](https://poser.pugx.org/wpbones/wptables/v/stable?style=for-the-badge)](https://packagist.org/packages/wpbones/wptables) \u0026nbsp;\n[![Latest Unstable Version](https://poser.pugx.org/wpbones/wptables/v/unstable?style=for-the-badge)](https://packagist.org/packages/wpbones/wptables) \u0026nbsp;\n[![Total Downloads](https://poser.pugx.org/wpbones/wptables/downloads?style=for-the-badge)](https://packagist.org/packages/wpbones/wptables) \u0026nbsp;\n[![License](https://poser.pugx.org/wpbones/wptables/license?style=for-the-badge)](https://packagist.org/packages/wpbones/wptables) \u0026nbsp;\n[![Monthly Downloads](https://poser.pugx.org/wpbones/wptables/d/monthly?style=for-the-badge)](https://packagist.org/packages/wpbones/wptables)\n\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/wpbones/wptables/graphs/contributors\"\u003e\n    \u003cimg src=\"https://contrib.rocks/image?repo=wpbones/wptables\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n![images](https://github.com/wpbones/wptables/wiki/images/screenshot-1.png)\n\nA fluent implementation of WordPress WP List Table for WP Bones\n\n## Requirements\n\nThis package works with a WordPress plugin written with [WP Bones framework library](https://github.com/wpbones/WPBones).\n\n## Installation\n\nYou can install third party packages by using:\n\n```sh copy\nphp bones require wpbones/wptables\n```\n\nI advise to use this command instead of `composer require` because doing this an automatic renaming will done.\n\nYou can use composer to install this package:\n\n```sh copy\ncomposer require wpbones/wptables\n```\n\nYou may also to add `\"wpbones/wptables\": \"^1.0\"` in the `composer.json` file of your plugin:\n\n```json copy filename=\"composer.json\" {4}\n  \"require\": {\n    \"php\": \"\u003e=7.4\",\n    \"wpbones/wpbones\": \"~0.8\",\n    \"wpbones/wptables\": \"~1.0\"\n  },\n```\n\nand run\n\n```sh copy\ncomposer install\n```\n\n## How to\n\nYou can use WP Tables either like subclass or like fluent class instance.\n\n### Subclassing\n\nAs subclass class instance you may create a your own class as show below:\n\n```php copy\n\u003c?php\n\nnamespace WPKirk\\Http\\Controllers;\n\nuse WPKirk\\WPTables\\Html\\WPTable;\n\nclass ExampleTable extends WPTable\n{\n\n  protected $name = 'Discos';\n\n  public function getColumnsAttribute()\n  {\n    return [\n      'id'          =\u003e 'Name',\n      'description' =\u003e 'Description',\n    ];\n  }\n\n  public function getItems( $args = [] )\n  {\n\n    $fake = [];\n\n    for( $i = 0; $i \u003c 20; $i++ ) {\n      $fake[] = [\n        'id' =\u003e \"Example {$i}\",\n        'description' =\u003e 'Some description...'\n      ];\n    }\n\n    return $fake;\n\n  }\n}\n```\n\nIn your view controller you have to use the `load` method in order to register the screen options:\n\n```php copy\n...\n  public function load()\n  {\n    ExampleTable::registerScreenOption();\n  }\n\n  public function index()\n  {\n    $table = new ExampleTable();\n\n    return WPKirk()\n      -\u003eview( 'dashboard.table' )\n      -\u003ewith( 'table', $table );\n  }\n...\n```\nIn your `ExampleTable` you may override:\n\n```php\n\npublic function getCheckBoxValueAttribute( $item )\n{\n   return $item[ 'my_colum' ];\n}\n\n// or\n\npublic function getCheckBoxColumnNameAttribute()\n{\n   return 'my_colum';\n}\n\n```\n\nThis will be the value used in the checkbox value.\n\n### Fluent\n\nIf you like use the `WPTable` as fluent instance, you have to set the columns twice.\n\n```php copy\n...\n  public function loadFluentExample()\n  {\n    WPTable::name( 'Books' )\n           -\u003ecolumns(\n              [\n                'id'          =\u003e 'Name',\n                'description' =\u003e 'Description',\n              ]\n            )\n           -\u003escreenOptionLabel( 'Rows' )\n           -\u003eregisterScreenOption();\n  }\n\n  public function indexFluentExample()\n  {\n\n    $items = [];\n\n    for ( $i = 0; $i \u003c 20; $i++ ) {\n      $items[] = [\n        'id'          =\u003e \"Book {$i}\",\n        'description' =\u003e 'Some description...',\n      ];\n    }\n\n    $table = WPTable::name( 'Books' )\n                    -\u003esingular( 'Book' )\n                    -\u003eplural( 'Books' )\n                    -\u003ecolumns(\n                      [\n                        'id'          =\u003e 'Name',\n                        'description' =\u003e 'Description',\n                      ]\n                    )\n                    -\u003esetItems( $items );\n\n    return WPKirk()\n      -\u003eview( 'dashboard.table' )\n      -\u003ewith( 'table', $table );\n  }\n\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwpbones%2Fwptables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwpbones%2Fwptables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwpbones%2Fwptables/lists"}