{"id":19478455,"url":"https://github.com/jadob/objectable","last_synced_at":"2026-02-24T09:06:46.538Z","repository":{"id":56995688,"uuid":"456036040","full_name":"jadob/objectable","owner":"jadob","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-22T17:26:57.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T22:28:23.592Z","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/jadob.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-02-06T02:19:31.000Z","updated_at":"2025-04-19T19:59:48.000Z","dependencies_parsed_at":"2024-08-01T01:13:18.828Z","dependency_job_id":"f5e5d607-9b14-4c43-bed0-adbdb2343955","html_url":"https://github.com/jadob/objectable","commit_stats":{"total_commits":21,"total_committers":1,"mean_commits":21.0,"dds":0.0,"last_synced_commit":"58238f904f4711b96cd8ba0c95f2062ffb839dc6"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/jadob/objectable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jadob%2Fobjectable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jadob%2Fobjectable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jadob%2Fobjectable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jadob%2Fobjectable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jadob","download_url":"https://codeload.github.com/jadob/objectable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jadob%2Fobjectable/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29777691,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T04:54:30.205Z","status":"ssl_error","status_checked_at":"2026-02-24T04:53:58.628Z","response_time":75,"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":[],"created_at":"2024-11-10T19:49:52.343Z","updated_at":"2026-02-24T09:06:46.247Z","avatar_url":"https://github.com/jadob.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jadob/objectable\n\nReflection-based class normalizer. \n\n\n## Usage\n```php\nclass UserReadModel {\n    \n    public function __construct(\n    #[\\Jadob\\Objectable\\Annotation\\Field(name: 'username', context: ['PUBLIC_API', 'PRIVATE_API'])]\n    private string $username,\n\n    #[\\Jadob\\Objectable\\Annotation\\Field(name: 'banReason',  context: ['PRIVATE_API'])]    \n    private string $banReason,\n    \n    #[\\Jadob\\Objectable\\Annotation\\Field(name: 'createdAt',  context: ['PUBLIC_API', 'PRIVATE_API'], dateFormat: 'Y-m-d')]\n    private DateTimeInterface $createdAt\n    ) {\n    \n    }\n}\n\n$user = new UserReadModel('mickey', 'spam', new DateTime('2012-12-12'));\n\n$itemProcessor = new \\Jadob\\Objectable\\ItemProcessor();\n\n/**\n *  ['username' =\u003e 'mickey', 'createdAt' =\u003e '2012-12-12']\n */\n$publicResponse = $itemProcessor-\u003eextractItemValues($user, 'PUBLIC_API');\n\n\n/**\n *  ['username' =\u003e 'mickey', 'banReason' =\u003e 'spam', 'createdAt' =\u003e '2012-12-12']\n */\n$managementResponse = $itemProcessor-\u003eextractItemValues($user, 'PRIVATE_API');\n\n```\n\n\nWhen you need to handle specific use case, you can create a class implementing\n`Jadob\\Objectable\\Transformer\\ItemTransformerInterface` and pass them to `ItemProcessor`:\n\n\n```php\nclass MyClass {\n    public function __construct(\n        public string $key\n    ) {}\n}\n\nclass TopSecretTransformer implements \\Jadob\\Objectable\\Transformer\\ItemTransformerInterface {\n\n    public function supports(string $className,string $context) : bool {\n    \n        return $className === MyClass::class \u0026\u0026 $context === 'TOP_SECRET';\n    }   \n    \n    /**\n     * @param MyClass $object\n     * @return array\n     */\n    public function process(object $object) : array{\n        return [\n            'key' =\u003e str_rot13($object-\u003ekey)\n        ];   \n    }\n}\n\n\n$itemProcessor = new \\Jadob\\Objectable\\ItemProcessor(\n    itemTransformers: [\n        new TopSecretTransformer()\n    ]\n);\n\n/**\n * ['key' =\u003e 'uryyb']\n */\n$result = $itemProcessor-\u003eextractItemValues(new MyClass('hello'), 'TOP_SECRET');\n```\n\nWhen any transformer would be matched, `extractItemValues` will return the values from transformers, no further processing will be done.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjadob%2Fobjectable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjadob%2Fobjectable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjadob%2Fobjectable/lists"}