{"id":23036861,"url":"https://github.com/degraciamathieu/aggregate-entity-valueobject","last_synced_at":"2025-04-02T23:17:19.271Z","repository":{"id":231567995,"uuid":"782045901","full_name":"DeGraciaMathieu/aggregate-entity-valueobject","owner":"DeGraciaMathieu","description":"Small exercise to differentiate the concepts of aggregate, entity, and value object in PHP.","archived":false,"fork":false,"pushed_at":"2024-04-05T06:33:29.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T04:41:37.010Z","etag":null,"topics":["aggregate","clean-architecture","entity","php","value-object"],"latest_commit_sha":null,"homepage":"","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/DeGraciaMathieu.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-04-04T14:33:23.000Z","updated_at":"2024-08-08T17:25:32.000Z","dependencies_parsed_at":"2024-04-04T17:29:36.668Z","dependency_job_id":"2fe4801e-f109-4746-a248-a8e01e326f2b","html_url":"https://github.com/DeGraciaMathieu/aggregate-entity-valueobject","commit_stats":null,"previous_names":["degraciamathieu/aggregate-entity-valueobject"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeGraciaMathieu%2Faggregate-entity-valueobject","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeGraciaMathieu%2Faggregate-entity-valueobject/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeGraciaMathieu%2Faggregate-entity-valueobject/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeGraciaMathieu%2Faggregate-entity-valueobject/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DeGraciaMathieu","download_url":"https://codeload.github.com/DeGraciaMathieu/aggregate-entity-valueobject/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246905869,"owners_count":20852819,"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":["aggregate","clean-architecture","entity","php","value-object"],"created_at":"2024-12-15T17:27:56.830Z","updated_at":"2025-04-02T23:17:19.245Z","avatar_url":"https://github.com/DeGraciaMathieu.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aggregate-entity-valueobject\nSmall exercise to differentiate the concepts of aggregate, entity, and value object in PHP.\n\n## Architecture\n![qsdsqdqs](https://github.com/DeGraciaMathieu/aggregate-entity-valueobject/assets/11473997/fc574cb0-b855-4d20-a221-05cc9d408a40)\n\n### Aggregate\nAn aggregate represents a business concept (ex: budget).\nIt is responsible for containing and ensuring the reliability of the entities it contains (ex: a budget contains transactions).\nIt can also provide entry points to manipulate and interact with its entities (ex: retrieve the amount of transactions).\n\n### Entity\nAn entity represents a business concept, similar to aggregates, but on a smaller and individual scale.\nThe values of an entity are always value objects (ex: Name, Amount ...) to protect against primitive obsession.\nAn entity has methods to manipulate its properties, these intermediary methods are essential to avoid exposing the internal structure of the object and to respect the Law of Demeter.\n\n### Value object\nA value object is a reusable class that encapsulates non-business logic.\nIts responsibility is to represent a meaningful characteristic and ensure the correctness and relevance of its value. \n\n## Usage\n```php\n$budget = new App\\Aggregators\\Budget();\n\n$budget-\u003eaddTransaction(\n    new App\\Entities\\Transaction(\n        new App\\ValuesObjects\\Uuid('3a535f13-a832-49c1-9156-4dd67744c197'),\n        new App\\ValuesObjects\\Name(''),\n        new App\\ValuesObjects\\Amount(10),\n    ),\n);\n\n$budget-\u003eaddTransaction(\n    new App\\Entities\\Transaction(\n        new App\\ValuesObjects\\Uuid('a086e8a5-e016-4f84-b888-c918a70809e6'),\n        new App\\ValuesObjects\\Name(''),\n        new App\\ValuesObjects\\Amount(30),\n    ),\n);\n\n$budget-\u003eamount();\n```\n![](https://github.com/DeGraciaMathieu/aggregate-entity-valueobject/assets/11473997/d9353c77-6363-4788-a358-fcf80bbe35d9)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegraciamathieu%2Faggregate-entity-valueobject","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdegraciamathieu%2Faggregate-entity-valueobject","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegraciamathieu%2Faggregate-entity-valueobject/lists"}