{"id":18382865,"url":"https://github.com/e-commit/paginator","last_synced_at":"2025-04-11T21:26:56.455Z","repository":{"id":56974779,"uuid":"367946019","full_name":"e-commit/paginator","owner":"e-commit","description":null,"archived":false,"fork":false,"pushed_at":"2024-01-01T12:58:27.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-25T04:45:02.975Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/e-commit.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}},"created_at":"2021-05-16T17:32:07.000Z","updated_at":"2024-06-22T09:48:47.376Z","dependencies_parsed_at":"2023-02-09T23:15:31.982Z","dependency_job_id":"a69b54d5-ef5d-4afe-9fa3-b646004ed7f0","html_url":"https://github.com/e-commit/paginator","commit_stats":{"total_commits":23,"total_committers":1,"mean_commits":23.0,"dds":0.0,"last_synced_commit":"d648c238a4077b56c9c63ea1bda65dc87ba98f92"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-commit%2Fpaginator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-commit%2Fpaginator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-commit%2Fpaginator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-commit%2Fpaginator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/e-commit","download_url":"https://codeload.github.com/e-commit/paginator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248482018,"owners_count":21111262,"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":[],"created_at":"2024-11-06T01:08:55.968Z","updated_at":"2025-04-11T21:26:56.428Z","avatar_url":"https://github.com/e-commit.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Paginator\n\nCreate a paginator.\n\n![Tests](https://github.com/e-commit/paginator/workflows/Tests/badge.svg)\n\n## Installation ##\n\nTo install paginator with Composer just run :\n\n```bash\n$ composer require ecommit/paginator\n```\n\n\n## Usage ##\n\n```php\nuse Ecommit\\Paginator\\ArrayPaginator;\n\n//Create a paginator\n$paginator = new ArrayPaginator([\n    //Options\n    'page' =\u003e 1,\n    'max_per_page' =\u003e 100,\n    'data' =\u003e ['val1', 'val2', 'val3'],\n    //Or with an ArrayIterator\n    //'data' =\u003e new \\ArrayIterator(['val1', 'val2', 'val3']),\n]);\n\n$totalPages = $paginator-\u003egetLastPage();\n$countRows = \\count($paginator);\nforeach ($paginator as $result) {\n    //...\n}\n```\n\n### Available options\n\n| Option | Type | Required | Default value | Description |\n| --- | --- | --- | --- | --- |\n| **page** | Integer | No | 1 | Current page |\n| **max_per_page** | Integer | No | 100 | Max elements per page |\n| **data** | Array or ArrayIterator | Yes | | \u003cul\u003e\u003cli\u003eIf `count` option is null : All data (of all pages)\u003c/li\u003e\u003cli\u003eIf `count` option is not null : Only the data to display on the current page\u003c/li\u003e\u003c/ul\u003e |\n| **count** | Integer or null | No | Null | *You can use this option when the data volume is too large.* If the value is not null :\u003cul\u003e\u003cli\u003eIt must equal the total number of results\u003c/li\u003e\u003cli\u003eThe `data` option must contain only the data to display on the current page\u003c/li\u003e\u003c/ul\u003e  |\n\n### Available methods\n\nSee [API documentation](src/PaginatorInterface.php)\n\n## License ##\n\nThis librairy is under the MIT license. See the complete license in *LICENSE* file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe-commit%2Fpaginator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fe-commit%2Fpaginator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe-commit%2Fpaginator/lists"}