{"id":18576106,"url":"https://github.com/thiagodp/datatables","last_synced_at":"2026-05-17T01:35:57.672Z","repository":{"id":57040943,"uuid":"56845647","full_name":"thiagodp/datatables","owner":"thiagodp","description":"PHP representation of (jQuery) Datatables's request and response.","archived":false,"fork":false,"pushed_at":"2018-02-12T23:57:28.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-21T15:55:09.791Z","etag":null,"topics":["datatables","jquery","php","phputil","request","response","wrapper"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thiagodp.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}},"created_at":"2016-04-22T09:55:04.000Z","updated_at":"2019-05-21T00:38:01.000Z","dependencies_parsed_at":"2022-08-23T22:00:09.721Z","dependency_job_id":null,"html_url":"https://github.com/thiagodp/datatables","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagodp%2Fdatatables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagodp%2Fdatatables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagodp%2Fdatatables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagodp%2Fdatatables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thiagodp","download_url":"https://codeload.github.com/thiagodp/datatables/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254447888,"owners_count":22072755,"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":["datatables","jquery","php","phputil","request","response","wrapper"],"created_at":"2024-11-06T23:23:36.233Z","updated_at":"2026-05-17T01:35:52.631Z","avatar_url":"https://github.com/thiagodp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Datatables\n\nPHP representation of [Datatables](https://datatables.net)' request and response.\n\nMain files: \n* Class [DataTablesRequest](https://github.com/thiagodp/datatables/blob/master/lib/DataTablesRequest.php)\n* Class [DataTablesResponse](https://github.com/thiagodp/datatables/blob/master/lib/DataTablesResponse.php)\n\nThis project uses [semantic versioning](http://semver.org/). See our [releases](https://github.com/thiagodp/datatables/releases).\n\n### Installation\n\n```command\ncomposer require phputil/datatables\n```\n\n### Example on version `2.x`\n\n```php\n\u003c?php\nrequire_once 'vendor/autoload.php';\n\nuse phputil\\datatables\\DataTablesRequest;\nuse phputil\\datatables\\DataTablesResponse;\n\n//\n// REQUEST\n//\n$req = new DataTablesRequest( $_POST );\n\n// PAGINATION\n$offset = $req-\u003estart;\n$limit = $req-\u003elength;\n\n// SEARCH\n$searchValue = $req-\u003esearchValue(); // Example: 'Alice'\n\n// FILTERING\n$search = $req-\u003ecolumnSearch(); // Example: array( 'name' =\u003e 'Bob', 'age' =\u003e 21 )\n\n// SORTING\n$order = $req-\u003ecolumnOrder(); // Example: array( 'name' =\u003e 'ASC', 'age' =\u003e 'DESC' )\n\n...\n\n//\n// RESPONSE\n//\n$totalCount = /* total number of records to return */\n$filteredCount = /* filtered number of records to return */\n$data = /* items to return */\n$draw = $req-\u003edraw; // From the request\n\n$res = new DataTablesResponse(\n\t$totalCount, $filteredCount, $data, $draw );\n\t\necho json_encode( $res );\n?\u003e\n```\n\n\n### Example on version `1.x`\n\n```php\n\u003c?php\nrequire_once 'vendor/autoload.php';\n\nuse phputil\\DataTablesRequest;\nuse phputil\\DataTablesResponse;\n\n//\n// REQUEST\n//\n$req = new DataTablesRequest( $_POST );\n\n// PAGINATION\n$limit = $req-\u003elimit();\n$offset = $req-\u003eoffset();\n\n// SEARCH\n$search = $req-\u003esearch(); // null in case of not having search\n\n// FILTERING\n$filters = $req-\u003efilters(); // Example: array( 'name' =\u003e 'Bob', 'age' =\u003e 21 )\n\n// SORTING\n//\tOriginally, Datatables returns the sort order\n//\tby column index, but here you can get it using\n//\tyour own column names.\n$orders = $req-\u003eorders( array( 'name', 'age' ) ); // Example: array( 'name' =\u003e 'asc', 'age' =\u003e 'desc' )\n\n...\n\n//\n// RESPONSE\n//\n$totalCount = /* total number of records to return */\n$filteredCount = /* filtered number of records to return */\n$data = /* items to return */\n$draw = $req-\u003edraw(); // From the request\n\n$res = new DataTablesResponse(\n\t$totalCount, $filteredCount, $data, $draw );\n\t\necho json_encode( $res );\n?\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagodp%2Fdatatables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthiagodp%2Fdatatables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagodp%2Fdatatables/lists"}