{"id":16749998,"url":"https://github.com/hakobyansen/phpenum","last_synced_at":"2025-03-16T04:20:09.639Z","repository":{"id":56954922,"uuid":"363724455","full_name":"hakobyansen/phpenum","owner":"hakobyansen","description":"All constants in your class, which extends Enum, will be converted to array of enum options.","archived":false,"fork":false,"pushed_at":"2021-05-07T11:09:55.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-23T08:20:02.486Z","etag":null,"topics":["constants","enum","php","reflection-api"],"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/hakobyansen.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}},"created_at":"2021-05-02T18:40:24.000Z","updated_at":"2021-05-07T11:08:56.000Z","dependencies_parsed_at":"2022-08-21T04:10:14.832Z","dependency_job_id":null,"html_url":"https://github.com/hakobyansen/phpenum","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakobyansen%2Fphpenum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakobyansen%2Fphpenum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakobyansen%2Fphpenum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakobyansen%2Fphpenum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hakobyansen","download_url":"https://codeload.github.com/hakobyansen/phpenum/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243823211,"owners_count":20353630,"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":["constants","enum","php","reflection-api"],"created_at":"2024-10-13T02:26:42.680Z","updated_at":"2025-03-16T04:20:09.609Z","avatar_url":"https://github.com/hakobyansen.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Enum\n\n\u003e This package provides you a class named Enum. It is designed to help you to structure\n\u003e your Enum classes easily and get rid of the most boilerplate code.\n\n## Usage\n\n### Installation\n\nInstall via composer:\n\n```\ncomposer require codebot/phpenum\n```\n\n### How to use\n\nAll your Enum classes should extend the abstract `Enum` class.\nAll constants in your class, which extends `Enum`, will be converted to enum options.\n\n```php\n\u003c?php\n\nnamespace App;\n\nuse Enum\\Enum;\n\nclass Status extends Enum\n{\n    const ACTIVE   = 'active';\n    const INACTIVE = 'inactive';\n    const BLOCKED  = 'blocked';\n}\n\n$status = new Status();\n\n$status-\u003etoArray(); // will return [ 'active' =\u003e 'active', 'inactive' =\u003e 'inactive', 'blocked' =\u003e 'blocked' ]\n$status-\u003ehasValue('active'); // will return boolean\n$status-\u003ehasKey('blocked'); // will return boolean\n```\n\nEnum constructor has 2 parameters: `$caseLower=true` and `$caseUpper=false`.\n\nIf you want the case of array keys to be same as constants case - pass `false` as `$caseLower`.\n\n```php\n$status = new Status(false);\n```\n\nIf you want the case of array keys to be uppercase - pass `false` as `$caseLower` and `true` as `$caseUpper`. \n\n```php\n$status = new Status(false, true);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhakobyansen%2Fphpenum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhakobyansen%2Fphpenum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhakobyansen%2Fphpenum/lists"}