{"id":19768029,"url":"https://github.com/gmitirol/toolkit-sorter","last_synced_at":"2026-06-25T08:31:22.428Z","repository":{"id":62511406,"uuid":"168317121","full_name":"gmitirol/toolkit-sorter","owner":"gmitirol","description":"Sort interfaces and implementations for PHP","archived":false,"fork":false,"pushed_at":"2022-10-19T13:22:16.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-02-28T10:58:22.729Z","etag":null,"topics":["file-sorting","php","php7","sort","sorter"],"latest_commit_sha":null,"homepage":null,"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/gmitirol.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":"2019-01-30T09:38:37.000Z","updated_at":"2022-06-01T12:05:21.000Z","dependencies_parsed_at":"2022-11-02T13:02:09.778Z","dependency_job_id":null,"html_url":"https://github.com/gmitirol/toolkit-sorter","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/gmitirol/toolkit-sorter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmitirol%2Ftoolkit-sorter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmitirol%2Ftoolkit-sorter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmitirol%2Ftoolkit-sorter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmitirol%2Ftoolkit-sorter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gmitirol","download_url":"https://codeload.github.com/gmitirol/toolkit-sorter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmitirol%2Ftoolkit-sorter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34767542,"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-06-25T02:00:05.521Z","response_time":101,"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":["file-sorting","php","php7","sort","sorter"],"created_at":"2024-11-12T04:34:20.052Z","updated_at":"2026-06-25T08:31:22.368Z","avatar_url":"https://github.com/gmitirol.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"PHP Toolkit - Sorter\n====================\n\nThis library provides simple abstractions for sort operations.\n\nIn version 1.0, toolkit-sorter provides easy sorting of files by various criteria.\nFiles are passed as `SplFileInfo` objects, e.g. as retrieved from Symfony the Finder component.\n\nAdditonal sort algorithms for reuse will be added in later releases.\n\nThe current build status and code analysis can be found here:\n  * [Scrutinizer CI](https://scrutinizer-ci.com/g/gmitirol/toolkit-sorter/)\n\nRequirements\n------------\n* PHP 5.6.0 or higher\n\nInstallation\n------------\nThe recommended way to install toolkit-sorter is via composer.\n```json\n\"require\": {\n    \"gmi/toolkit-sorter\": \"1.0.*\"\n}\n```\n\nUsage examples\n--------------\n\nSorting of SplFileInfo objects\n```php\nuse Gmi\\Toolkit\\Sorter\\NaturalFileSorter;\n\n$files = ['file1.pdf', 'file2.pdf'];\n$fileInfos = [];\nforeach ($files as $file) {\n    $fileInfos[] = new SplFileInfo($file);\n}\n\n$sorter = new NaturalFileSorter();\n$sorter-\u003esort($fileInfos);\n```\n\nSorting of SplFileInfo objects by multiple criteria\n```php\nuse Gmi\\Toolkit\\Sorter\\GroupSorter;\nuse Gmi\\Toolkit\\Sorter\\ExtensionFileSorter;\nuse Gmi\\Toolkit\\Sorter\\SizeFileSorter;\n\n$files = ['file1.pdf', 'file2.pdf', 'file3.pdf', 'file1.jpg', 'file4.pdf', 'file2.jpg'];\n$fileInfos = [];\nforeach ($files as $file) {\n    $fileInfos[] = new SplFileInfo($file);\n}\n\n$sorter = new GroupSorter([new ExtensionFileSorter(), new SizeFileSorter()]);\n$sorter-\u003esort($fileInfos);\n```\n\nSorting Symfony Finder results\n```php\nuse Symfony\\Component\\Finder\\Finder;\nuse Gmi\\Toolkit\\Sorter\\SizeFileSorter;\n\n$finder = new Finder();\n$finder-\u003efiles()-\u003ename('/\\.jpg$/i')-\u003ein($folder);\n$files = iterator_to_array($finder);\n\n$sorter = new SizeFileSorter();\n$sorter-\u003esort($files);\n```\n\nDirect sorting with Symfony Finder\n```php\nuse Symfony\\Component\\Finder\\Finder;\nuse Gmi\\Toolkit\\Sorter\\ModificationDateFileSorter;\n\n$finder = new Finder();\n$finder-\u003efiles()-\u003ename('/\\.jpg$/i')-\u003ein($folder);\n\n$sorter = new ModificationDateFileSorter();\n$finder-\u003esort($sorter-\u003egetClosure());\n```\n\nTests\n-----\nThe test suite can be run with `vendor/bin/phpunit tests`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmitirol%2Ftoolkit-sorter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgmitirol%2Ftoolkit-sorter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmitirol%2Ftoolkit-sorter/lists"}