{"id":28165731,"url":"https://github.com/siguici/typed","last_synced_at":"2025-05-15T12:12:06.523Z","repository":{"id":59201776,"uuid":"535910693","full_name":"siguici/typed","owner":"siguici","description":"Customize Object-Oriented PHP Variable Types","archived":false,"fork":false,"pushed_at":"2022-09-13T02:08:30.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T03:16:25.861Z","etag":null,"topics":["oop","oriented-object-programming","php8","sikessem","type-library","var-type"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/sikessem/type","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/siguici.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":"2022-09-13T01:20:59.000Z","updated_at":"2025-03-03T04:30:20.000Z","dependencies_parsed_at":"2022-09-13T04:15:47.263Z","dependency_job_id":null,"html_url":"https://github.com/siguici/typed","commit_stats":null,"previous_names":["siguici/typed"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siguici%2Ftyped","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siguici%2Ftyped/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siguici%2Ftyped/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siguici%2Ftyped/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/siguici","download_url":"https://codeload.github.com/siguici/typed/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254337508,"owners_count":22054255,"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":["oop","oriented-object-programming","php8","sikessem","type-library","var-type"],"created_at":"2025-05-15T12:12:06.365Z","updated_at":"2025-05-15T12:12:06.478Z","avatar_url":"https://github.com/siguici.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\u003ca href=\"https://sikessem.com/\" title=\"SIKessEm\"\u003e\u003cimg src=\"https://github.com/sikessem/sikessem/blob/main/SIKessEm-logo.png\" alt=\"SIKessEm logo\"/\u003e\u003c/a\u003e\u003c/div\u003e\n\n***\n\n# Customize Object-Oriented PHP Variable Types\n\nThis package allows to define variable types or to declare PHP variables from already existing object types.\n\n\n## Installation\n\nUsing [composer](https://getcomposer.org/), you can install Type with the following command:\n\n```bash\ncomposer require sikessem/type\n```\n\n\n## Usage\n\nDefine a variable type:\n\n```php\n\u003c?php\n\nnamespace App\\Types;\n\nuse Sikessem\\Type\\Statement;\n\nclass MyType implements Statement {\n    public function __construct(protected string $value) {\n        $this-\u003esetValue($value);\n    }\n\n    protected string $value;\n\n    public function setValue(string $value): self {\n        $this-\u003evalue = $value;\n        return $this;\n    }\n\n    public function getValue(): string {\n        return $this-\u003evalue;\n    }\n\n    public function dump(): void {\n        exit($this-\u003evalue);\n    }\n\n    // The method to define to parse a value\n    public static function parse(mixed $value): self {\n        return new self((string)$value);\n    }\n}\n\n```\n\nDeclare a variable with the defined type:\n\n```php\n\u003c?php\n\nuse App\\Types\\MyType;\n\n$myVar = let(MyType::class, 'Hello');\n$myVar-\u003edump(); // Exit with the string 'Hello'\n\n```\n\n## License\n\nThis library is distributed under the [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n\n## Security Reports\n\nPlease send any sensitive issue to [ske@sikessem.com](mailto:ske@sikessem.com). Thanks!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiguici%2Ftyped","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiguici%2Ftyped","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiguici%2Ftyped/lists"}