{"id":37262097,"url":"https://github.com/yungts97/enum-helpers","last_synced_at":"2026-01-15T23:14:25.806Z","repository":{"id":64159274,"uuid":"573831017","full_name":"yungts97/enum-helpers","owner":"yungts97","description":"A simple PHP package that provided some helper functions for PHP Enumeration.","archived":false,"fork":false,"pushed_at":"2022-12-07T08:51:20.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-14T13:55:10.870Z","etag":null,"topics":["enum","enumeration","helper-functions","php","php-library","php-package"],"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/yungts97.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-12-03T15:14:29.000Z","updated_at":"2022-12-03T15:47:24.000Z","dependencies_parsed_at":"2023-01-15T01:00:14.671Z","dependency_job_id":null,"html_url":"https://github.com/yungts97/enum-helpers","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/yungts97/enum-helpers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yungts97%2Fenum-helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yungts97%2Fenum-helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yungts97%2Fenum-helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yungts97%2Fenum-helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yungts97","download_url":"https://codeload.github.com/yungts97/enum-helpers/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yungts97%2Fenum-helpers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28473974,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T22:27:41.514Z","status":"ssl_error","status_checked_at":"2026-01-15T21:54:47.910Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["enum","enumeration","helper-functions","php","php-library","php-package"],"created_at":"2026-01-15T23:14:25.211Z","updated_at":"2026-01-15T23:14:25.802Z","avatar_url":"https://github.com/yungts97.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003ePHP Enum Helpers\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://packagist.org/packages/yungts97/enum-helpers\"\u003e\n        \u003cimg src=\"https://img.shields.io/packagist/v/yungts97/enum-helpers?color=24BDCC\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/yungts97/enum-helpers/blob/main/LICENSE.md\"\u003e\n        \u003cimg src=\"https://img.shields.io/packagist/l/yungts97/enum-helpers\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/yungts97/enum-helpers\"\u003e\n        \u003cimg src=\"https://img.shields.io/packagist/dt/yungts97/enum-helpers?color=ff69b4\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/yungts97/enum-helpers/actions\"\u003e\n        \u003cimg src=\"https://github.com/yungts97/enum-helpers/workflows/CI/badge.svg\"/\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n`yungts97/enum-helpers` is a PHP package that extended functionality of the PHP Enumeration. \n\n## 📦 Environment Requirements\n`PHP`: ^8.1\n\n## 🚀 Installation\nYou can install the package via composer:\n```bash\ncomposer require yungts97/enum-helpers\n```\n\n\n## ✨ How to use?\nThis package is very simple and easy to use. To extend the features of enum. You can add the trait in your enum.\n```php\nuse Yungts97\\EnumHelpers\\Traits\\Invokable;\nuse Yungts97\\EnumHelpers\\Traits\\Contains;\nuse Yungts97\\EnumHelpers\\Traits\\Random;\n\nenum Status: string\n{\n    use Invokable, Contains, Random; // add it here\n\n    case Draft = 'draft';\n    case Submitted = 'submitted';\n    case Pending = 'pending';\n    case Approved = 'approved';\n    case Rejected = 'rejected';\n}\n```\n### 1. Invokable\nThis trait allows Enum to be invokable.\n```php\nStatus::Pending() // \"pending\"\n```\n\n### 2. Contains\nThis trait allows checking whether the value exists in Enum. Agrument accepted `UnitEnum`, `BackedEnum`, `String` and `Int`.\n```php\nStatus::contains('pending') // true \nStatus::contains(Status::Draft) // true\nStatus::contains(Status::Refund) // false \n```\n\n### 3. Random\nThis trait allows Enum to return random value(s).\n```php\nStatus::random() // Status::Draft \nStatus::random(1) // Status::Draft\nStatus::random(2) // [Status::Draft, Status::Approved]\n```\n\n## 📃 License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyungts97%2Fenum-helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyungts97%2Fenum-helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyungts97%2Fenum-helpers/lists"}