{"id":28522753,"url":"https://github.com/thedragoncode/size-sorter","last_synced_at":"2025-07-06T02:31:36.292Z","repository":{"id":65649988,"uuid":"596535163","full_name":"TheDragonCode/size-sorter","owner":"TheDragonCode","description":"Easily sort clothing size, height, bra size, furniture size and more","archived":false,"fork":false,"pushed_at":"2025-02-24T17:56:31.000Z","size":112,"stargazers_count":34,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-03T10:31:20.881Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/TheDragonCode.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},"funding":{"custom":["https://boosty.to/dragon-code","https://yoomoney.ru/to/410012608840929","https://www.donationalerts.com/r/dragon_code"]}},"created_at":"2023-02-02T11:57:06.000Z","updated_at":"2025-06-04T09:33:40.000Z","dependencies_parsed_at":"2023-12-30T10:32:44.070Z","dependency_job_id":"eeadd425-0365-42f6-8087-d23c6c90b321","html_url":"https://github.com/TheDragonCode/size-sorter","commit_stats":{"total_commits":55,"total_committers":3,"mean_commits":"18.333333333333332","dds":0.2909090909090909,"last_synced_commit":"d292063b8c281632d8568f1d71feb4284422c0e5"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/TheDragonCode/size-sorter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDragonCode%2Fsize-sorter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDragonCode%2Fsize-sorter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDragonCode%2Fsize-sorter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDragonCode%2Fsize-sorter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheDragonCode","download_url":"https://codeload.github.com/TheDragonCode/size-sorter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDragonCode%2Fsize-sorter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263838649,"owners_count":23518126,"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":"2025-06-09T09:31:12.858Z","updated_at":"2025-07-06T02:31:36.286Z","avatar_url":"https://github.com/TheDragonCode.png","language":"PHP","funding_links":["https://boosty.to/dragon-code","https://yoomoney.ru/to/410012608840929","https://www.donationalerts.com/r/dragon_code"],"categories":[],"sub_categories":[],"readme":"# Product Size Sorter\n\n![The Dragon Code Product size sorting](https://preview.dragon-code.pro/TheDragonCode/Product%20size%20sorting.svg?brand=php)\n\n[![Stable Version][badge_stable]][link_packagist]\n[![Unstable Version][badge_unstable]][link_packagist]\n[![Total Downloads][badge_downloads]][link_packagist]\n[![Github Workflow Status][badge_build]][link_build]\n[![License][badge_license]][link_license]\n\n\u003e Easily sort clothing size, height, bra size, furniture size and more\n\n## Installation\n\nTo get the latest version of `Product Size Sorter`, simply require the project using [Composer](https://getcomposer.org):\n\n```bash\ncomposer require dragon-code/size-sorter\n```\n\nOr manually update `require` block of `composer.json` and run composer update.\n\n```json\n{\n    \"require\": {\n        \"dragon-code/size-sorter\": \"^1.0\"\n    }\n}\n```\n\n## Compatibility\n\n\u003e Note\n\u003e \n\u003e This package can work outside the frameworks systems.\n\n| Compatibility | Versions          |\n|:--------------|:------------------|\n| PHP           | ^8.1              |\n| Laravel       | ^8.0, ^9.0, ^10.0 |\n| Symfony       | ^5.3, ^6.0        |\n\n## Usage\n\nWhen calling a sort with common values, each element will be assigned to one of five groups:\n\n1. Letter clothing size (XXS, XS, M, L, etc.)\n2. Numerical size of clothes and shoes (9, 10, 44-46, 48, etc.)\n3. Bra size (70B, 75A, 80C, etc...)\n4. Overall dimensions of items (40x38x19 sm, etc.)\n5. Other values\n\n```php\nuse DragonCode\\SizeSorter\\Sorter;\n\nreturn Sorter::sort(collect([\n    'XXL',\n    '26',\n    '28',\n    'XL',\n    'ONE SIZE',\n    'XXS',\n    '2',\n    '54',\n]));\n\n/*\n * Returns:\n * \n * Collection([\n *   'XXS',\n *   'XL',\n *   'XXL',\n *   '2',\n *   '26',\n *   '28',\n *   '54',\n *   'ONE SIZE',\n * ])\n */\n```\n\n```php\nuse DragonCode\\SizeSorter\\Sorter;\n\n$items = Size::query()-\u003eget();\n\nreturn Sorter::sort($items, 'title');\n```\n\n\u003e You can see more examples in the [test file](tests/Sorters/SorterTest.php).\n\n### Groups Order\n\nBy default, sizes are sorted by the following logical blocks:\n\n1. Letter clothing size (XXS, XS, M, L, etc.)\n2. Numerical size of clothes and shoes (9, 10, 44-46, 48, etc.)\n3. Bra size (70B, 75A, 80C, etc...)\n4. Overall dimensions of items (40x38x19 sm, etc.)\n5. Other values\n\nBut you can change the order by specifying identifiers as the third parameter:\n\n```php\nuse DragonCode\\SizeSorter\\Enum\\Group;\nuse DragonCode\\SizeSorter\\Sorter;\n\nreturn Sorter::sort($items, groupsOrder: [3, 5, 4, 2, 1]);\n// or\nreturn Sorter::sort($items, groupsOrder: [Group::GROUP_3, Group::GROUP_5, Group::GROUP_4, Group::GROUP_2, Group::GROUP_1]);\n```\n\nThe final array will be formed in the specified order:\n\n```\n3 - 5 - 4 - 2 - 1\n```\n\nYou can also specify some groups. For example:\n\n```php\nuse DragonCode\\SizeSorter\\Enum\\Group;\nuse DragonCode\\SizeSorter\\Sorter;\n\nreturn Sorter::sort($items, groupsOrder: [3, 5]);\n// or\nreturn Sorter::sort($items, groupsOrder: [Group::GROUP_3, Group::GROUP_5]);\n```\n\nIn this case, the first two logical groups will be sorted in the specified order, and the subsequent ones will be in ascending order:\n\n```\n3 - 5 - 1 - 2 - 4\n```\n\n## License\n\nThis package is licensed under the [MIT License](LICENSE).\n\n\n[badge_build]:          https://img.shields.io/github/actions/workflow/status/TheDragonCode/size-sorter/phpunit.yml?style=flat-square\n\n[badge_downloads]:      https://img.shields.io/packagist/dt/dragon-code/size-sorter.svg?style=flat-square\n\n[badge_license]:        https://img.shields.io/packagist/l/dragon-code/size-sorter.svg?style=flat-square\n\n[badge_stable]:         https://img.shields.io/github/v/release/TheDragonCode/size-sorter?label=stable\u0026style=flat-square\n\n[badge_unstable]:       https://img.shields.io/badge/unstable-dev--main-orange?style=flat-square\n\n[link_build]:           https://github.com/TheDragonCode/size-sorter/actions\n\n[link_license]:         LICENSE\n\n[link_packagist]:       https://packagist.org/packages/dragon-code/size-sorter\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthedragoncode%2Fsize-sorter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthedragoncode%2Fsize-sorter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthedragoncode%2Fsize-sorter/lists"}