{"id":41916730,"url":"https://github.com/spekkionu/property-access","last_synced_at":"2026-01-25T16:30:36.766Z","repository":{"id":29738540,"uuid":"33281958","full_name":"spekkionu/property-access","owner":"spekkionu","description":"Trait that automatically calls getters and setters for property access.","archived":false,"fork":false,"pushed_at":"2017-12-23T04:59:56.000Z","size":16,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-11T21:45:48.982Z","etag":null,"topics":["getters","php","setters"],"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/spekkionu.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":"2015-04-02T01:15:10.000Z","updated_at":"2017-12-23T04:29:34.000Z","dependencies_parsed_at":"2022-07-21T04:24:12.582Z","dependency_job_id":null,"html_url":"https://github.com/spekkionu/property-access","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/spekkionu/property-access","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spekkionu%2Fproperty-access","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spekkionu%2Fproperty-access/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spekkionu%2Fproperty-access/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spekkionu%2Fproperty-access/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spekkionu","download_url":"https://codeload.github.com/spekkionu/property-access/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spekkionu%2Fproperty-access/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28755498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T13:59:49.818Z","status":"ssl_error","status_checked_at":"2026-01-25T13:59:33.728Z","response_time":113,"last_error":"SSL_read: 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":["getters","php","setters"],"created_at":"2026-01-25T16:30:35.952Z","updated_at":"2026-01-25T16:30:36.760Z","avatar_url":"https://github.com/spekkionu.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Property Access Trait\n\n[![Build Status](https://travis-ci.org/spekkionu/property-access.svg?branch=master)](https://travis-ci.org/spekkionu/property-access)\n[![Code Coverage](https://scrutinizer-ci.com/g/spekkionu/property-access/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/spekkionu/property-access/?branch=master)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/spekkionu/property-access/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/spekkionu/property-access/?branch=master)\n[![SensioLabsInsight](https://insight.sensiolabs.com/projects/f01daa7f-b46d-4575-aeb8-7be3885d4967/mini.png)](https://insight.sensiolabs.com/projects/f01daa7f-b46d-4575-aeb8-7be3885d4967)\n\nTrait that automatically calls getters and setters for property access.\n\n\n```php\nuse Spekkionu\\PropertyAccess\\PropertyAccessTrait;\n\nclass ExampleClass\n{\n    use PropertyAccessTrait;\n\n    private $name;\n\n    private $email;\n\n}\n```\n\n```php\n\n$example = new ExampleClass();\n\n$example-\u003ename = 'Bob';\n$example-\u003eemail = 'bob@example.com';\n\necho $example-\u003ename; // Bob\n\n$example-\u003efill(array(\n    'name' =\u003e 'Steve',\n    'email' =\u003e 'steve@example.com'\n));\n\necho $example-\u003eemail; // steve@example.com\n```\n\n## Getters and Setters will be called\n\n### You can even use Value Objects\n\n```php\nuse Spekkionu\\PropertyAccess\\PropertyAccessTrait;\n\nclass ExampleClass\n{\n    use PropertyAccessTrait;\n\n    private $name;\n\n    private $email;\n\n    public function setEmail(EmailAddress $email){\n        $this-\u003eemail = $email;\n    }\n\n}\n\n// Value Object\nclass EmailAddress\n{\n    private $email;\n\n    public function __construct($email)\n    {\n        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {\n            throw new InvalidArgumentException('Not a valid email address.');\n        }\n        $this-\u003eemail = $email;\n    }\n\n    public function getValue()\n    {\n        return $this-\u003eemail;\n    }\n\n    public function __toString()\n    {\n        return $this-\u003egetValue();\n    }\n}\n\n// Usage\n$example = new ExampleClass();\n$example-\u003eemail = new EmailAddress('bob@example.com');\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspekkionu%2Fproperty-access","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspekkionu%2Fproperty-access","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspekkionu%2Fproperty-access/lists"}