{"id":19237147,"url":"https://github.com/extalionlab/php-enum","last_synced_at":"2026-06-10T20:31:43.568Z","repository":{"id":62503334,"uuid":"188678486","full_name":"eXtalionLab/php-enum","owner":"eXtalionLab","description":"Gives the ability to emulate and create enumeration objects in PHP. ","archived":false,"fork":false,"pushed_at":"2020-04-24T21:05:22.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-05T01:41:46.025Z","etag":null,"topics":["enum","php","type"],"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/eXtalionLab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-05-26T12:12:16.000Z","updated_at":"2020-04-24T21:05:24.000Z","dependencies_parsed_at":"2022-11-02T10:16:02.634Z","dependency_job_id":null,"html_url":"https://github.com/eXtalionLab/php-enum","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eXtalionLab%2Fphp-enum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eXtalionLab%2Fphp-enum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eXtalionLab%2Fphp-enum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eXtalionLab%2Fphp-enum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eXtalionLab","download_url":"https://codeload.github.com/eXtalionLab/php-enum/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240324060,"owners_count":19783453,"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":["enum","php","type"],"created_at":"2024-11-09T16:24:59.732Z","updated_at":"2026-06-10T20:31:43.505Z","avatar_url":"https://github.com/eXtalionLab.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-enum\n\nGives the ability to emulate and create enumeration objects in PHP.\n\n## Install\n\n```bash\ncomposer install extalion/php-enum\n```\n\n## How to use\n\nEnum definition:\n\n```php\n/**\n * @method static RequestMethod get()\n * @method static RequestMethod post()\n */\nfinal class RequestMethod extends \\Enum\n{\n    const VALUES = [\n        'get' =\u003e 1,\n        'post' =\u003e 2\n    ];\n}\n```\n\nUsage:\n\n```php\nfunction request(string $url, RequestMethod $method, array $data = [])\n{\n    // ...\n\n    if ($method === RequestMethod::post()) {\n        \\curl_setopt($ch, \\CURLOPT_POST, 1);\n        \\curl_setopt($ch, \\CURLOPT_POSTFIELDS, $data);\n    }\n\n    // ...\n}\n```\n\n## Tests\n\n```php\nphp -d zend.assertions=1 test.php\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextalionlab%2Fphp-enum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fextalionlab%2Fphp-enum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextalionlab%2Fphp-enum/lists"}