{"id":15027484,"url":"https://github.com/egorbulychev/enumshelper","last_synced_at":"2026-02-05T12:32:44.849Z","repository":{"id":65408879,"uuid":"591821380","full_name":"EgorBulychev/EnumsHelper","owner":"EgorBulychev","description":"Enums Helper Traits for PHP 8.1+ ❤","archived":false,"fork":false,"pushed_at":"2023-01-25T00:58:34.000Z","size":23,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-13T03:15:49.131Z","etag":null,"topics":["helper","php81","traits"],"latest_commit_sha":null,"homepage":"","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/EgorBulychev.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":"2023-01-22T01:01:13.000Z","updated_at":"2023-09-30T15:44:55.000Z","dependencies_parsed_at":"2023-02-14T03:32:52.971Z","dependency_job_id":null,"html_url":"https://github.com/EgorBulychev/EnumsHelper","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EgorBulychev%2FEnumsHelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EgorBulychev%2FEnumsHelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EgorBulychev%2FEnumsHelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EgorBulychev%2FEnumsHelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EgorBulychev","download_url":"https://codeload.github.com/EgorBulychev/EnumsHelper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243330319,"owners_count":20274039,"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":["helper","php81","traits"],"created_at":"2024-09-24T20:06:31.362Z","updated_at":"2026-02-05T12:32:44.757Z","avatar_url":"https://github.com/EgorBulychev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Enums Helper Traits for PHP 8.1+ ❤\n\n## Installation\n\u003e composer require bulychev/enums\n\n## Usage trait\n\n```php\n/**\n * @method static int USER()\n * @method static int ADMIN()\n * @method static int ROOT()\n */\n#[Property(Description::class)]\nenum Role: int\n{\n    use EnumsHelper;\n\n    #[Description('Standard user account')]\n    case USER = 10;\n\n    #[Description('User with advanced permissions')]\n    case ADMIN = 50;\n\n    #[Description('User with full permissions')]\n    case ROOT = 99;\n}\n```\n\n#### `__invoke \u0026 __callStatic`: int|string\nBackedEnum\n```php\nRole::ADMIN(); // int(50)\nRole::ROOT(); // int(99)\nRole::MANAGER(); // throw new UndefinedEnumCaseException\n```\n\nUnitEnum\n```php\n/**\n * @method static string RU()\n * @method static string KG()\n * @method static string EN()\n */\nenum Lang\n{\n    use EnumsHelper;\n    \n    case RU;\n    case KG;\n    case EN;\n}\nRole::RU(); // string(2) \"RU\"\nRole::KG(); // string(2) \"KG\"\nRole::EN(); // string(2) \"EN\"\n```\n\n#### `names()`: array\n```php\nRole::names();\n// array(3) {\n//   [0]=\u003e string(4) \"USER\"\n//   [1]=\u003e string(5) \"ADMIN\"\n//   [2]=\u003e string(4) \"ROOT\"\n// }\n```\n\n#### `values()`: array\n```php\nRole::values();\n// array(3) {\n//   [0]=\u003e int(10)\n//   [1]=\u003e int(50)\n//   [2]=\u003e int(99)\n// }\n```\n\n#### `array()`: array\n```php\nRole::array();\n// array(3) {\n//   [10]=\u003e string(4) \"USER\"\n//   [50]=\u003e string(5) \"ADMIN\"\n//   [99]=\u003e string(4) \"ROOT\"\n// }\n```\n\n#### `description()`: ?string\n```php\nRole::ROOT-\u003edescription();\n// string(26) \"User with full permissions\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegorbulychev%2Fenumshelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fegorbulychev%2Fenumshelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegorbulychev%2Fenumshelper/lists"}