{"id":37234646,"url":"https://github.com/devmakerlab/entities","last_synced_at":"2026-01-15T04:00:07.858Z","repository":{"id":47162332,"uuid":"352625451","full_name":"devmakerlab/entities","owner":"devmakerlab","description":null,"archived":false,"fork":false,"pushed_at":"2022-02-20T02:10:36.000Z","size":60,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-10T07:02:28.032Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devmakerlab.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-29T11:53:20.000Z","updated_at":"2022-02-20T01:35:15.000Z","dependencies_parsed_at":"2022-09-19T01:30:31.670Z","dependency_job_id":null,"html_url":"https://github.com/devmakerlab/entities","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/devmakerlab/entities","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmakerlab%2Fentities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmakerlab%2Fentities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmakerlab%2Fentities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmakerlab%2Fentities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devmakerlab","download_url":"https://codeload.github.com/devmakerlab/entities/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmakerlab%2Fentities/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28419748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-15T04:00:07.288Z","updated_at":"2026-01-15T04:00:07.829Z","avatar_url":"https://github.com/devmakerlab.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DevMakerLab - Entities\n\n[![Run tests](https://github.com/devmakerlab/entities/workflows/Run%20tests/badge.svg)](https://github.com/devmakerlab/entities/actions)\n[![Code Coverage](https://scrutinizer-ci.com/g/devmakerlab/entities/badges/coverage.png?b=master\u0026s=dd1cff48e15466abb5806c83ddccb1603814b779)](https://scrutinizer-ci.com/g/devmakerlab/entities/?branch=master)\n[![Latest Stable Version](https://poser.pugx.org/devmakerlab/entities/v/stable)](https://packagist.org/packages/devmakerlab/entities)\n\nThis package provide a way to implements entities. Useful for your services or repositories.\n\n## Usage\n\nCreate your entity in dedicated class :\n\n```php\nuse DevMakerLab\\Entity;\n\nclass Human extends Entity\n{\n    public string $name;\n    public int $age;\n}\n```\n\nThen instanciate a new entity like that :\n\n```php\n$human = new Human([\n    'name' =\u003e 'Bob',\n    'age' =\u003e 42,\n]);\n\necho $human-\u003ename; // Bob\necho $human-\u003eage; // 42\n```\n\nCreate your entity list like this :\n\n```php\nuse DevMakerLab\\EntityList;\n\nclass People extends EntityList\n{\n    public function getYoungest(): Human\n    {       \n        $entities = $this-\u003eentities;\n\n        uasort($entities, function ($a, $b) {\n            if ($a-\u003eage === $b-\u003eage) {\n                return 0;\n            }\n    \n            return ($a \u003e $b) ? -1 : 1;\n        });\n\n        return array_pop($entities);\n    }\n}\n```\n\nThen instanciate a list like that :\n\n```php\n$bob = new Human(['name' =\u003e 'Bob', 'age' =\u003e 45]);\n$junior = new Human(['name' =\u003e 'Junior', 'age' =\u003e 21]);\n$jane = new Human(['name' =\u003e 'Jane', 'age' =\u003e 31]);\n\n$people = new People([$bob, $junior]);\n$people[] = $jane;\n\necho $people[0]-\u003ename; // Bob\necho $people[1]-\u003ename; // Junior\necho $people-\u003egetYoungest()-\u003ename; // Junior\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevmakerlab%2Fentities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevmakerlab%2Fentities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevmakerlab%2Fentities/lists"}