{"id":20681993,"url":"https://github.com/artkonekt/enum","last_synced_at":"2025-07-07T05:03:37.047Z","repository":{"id":57008308,"uuid":"60036504","full_name":"artkonekt/enum","owner":"artkonekt","description":"PHP Enum Component","archived":false,"fork":false,"pushed_at":"2025-03-03T12:26:02.000Z","size":129,"stargazers_count":20,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-19T12:07:56.203Z","etag":null,"topics":["enum","php-enum"],"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/artkonekt.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-05-30T20:15:36.000Z","updated_at":"2025-03-03T12:26:05.000Z","dependencies_parsed_at":"2023-11-17T14:36:36.543Z","dependency_job_id":"27746c67-806f-4450-a4c2-839c519e00cc","html_url":"https://github.com/artkonekt/enum","commit_stats":{"total_commits":90,"total_committers":5,"mean_commits":18.0,"dds":"0.24444444444444446","last_synced_commit":"239a2f7a61cb7f81976190d24d1a7f8ef4bf5bbc"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/artkonekt/enum","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artkonekt%2Fenum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artkonekt%2Fenum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artkonekt%2Fenum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artkonekt%2Fenum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artkonekt","download_url":"https://codeload.github.com/artkonekt/enum/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artkonekt%2Fenum/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264016713,"owners_count":23544623,"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-enum"],"created_at":"2024-11-16T22:12:28.157Z","updated_at":"2025-07-07T05:03:37.031Z","avatar_url":"https://github.com/artkonekt.png","language":"PHP","readme":"# Konekt Enum\n\n[![Tests](https://img.shields.io/github/actions/workflow/status/artkonekt/enum/tests.yml?branch=master\u0026style=flat-square)](https://github.com/artkonekt/enum/actions?query=workflow%3Atests)\n[![Packagist Stable Version](https://img.shields.io/packagist/v/konekt/enum.svg?style=flat-square\u0026label=stable)](https://packagist.org/packages/konekt/enum)\n[![Packagist downloads](https://img.shields.io/packagist/dt/konekt/enum.svg?style=flat-square)](https://packagist.org/packages/konekt/enum)\n[![StyleCI](https://styleci.io/repos/60036504/shield?branch=master)](https://styleci.io/repos/60036504)\n[![MIT Software License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE.md)\n\n## PHP Enum Class\n\n\u003e Enums are handy when a variable (especially a method parameter) can only take one out of a small set of possible values.\n\nKonekt Enum is a lightweight abstract class that enables creation of PHP enums.\n\n\u003e **Why not PHP 8.1 Enums?** This package was created back in 2013, and has been in use across many libraries.\n\u003e We're planning to find the way to make this package be based on native PHP enums AND keep compatibility\n\u003e with earlier versions as much as possible. This is expected in the **v5.0** release of this package.\n\n### Usage\n\nExtend the base class and define constants on it:\n\n##### Example\n\n```php\nclass ChessPiece extends \\Konekt\\Enum\\Enum {\n    const KING   = 'king';\n    const QUEEN  = 'queen';\n    const ROOK   = 'rook';\n    const BISHOP = 'bishop';\n    const KNIGHT = 'knight';\n    const PAWN   = 'pawn';\n}\n\nvar $queen = new ChessPiece('queen');\n```\n\n## Installation\n\nusing composer: `composer require konekt/enum`\n\n## Documentation\n\nFor detailed usage and examples go to the\n[Konekt Enum Documentation](https://konekt.dev/enum) or refer to the\nmarkdown files in the `docs/` folder of this repo.\n\nFor the list of changes read the [Changelog](Changelog.md).\n\n## Upgrade\n\n- From 3.x -\u003e 4.x see [Upgrade to 4.0](https://konekt.dev/enum/4.x/upgrade#from-v3-to-v4)\n- From 2.x -\u003e 3.x see [Upgrade to 3.0](https://konekt.dev/enum/4.x/upgrade#from-v2-to-v3)\n- From 1.x -\u003e 2.x see [Upgrade to 2.0](https://konekt.dev/enum/4.x/upgrade#from-v1-to-v2)\n\n## Laravel Eloquent Integration\n\nThere is a tiny trait for Laravel that helps you to automatically map fields of Eloquent models to/from Enum objects. For more details go to the [konekt/enum-eloquent](https://github.com/artkonekt/enum-eloquent) package.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartkonekt%2Fenum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartkonekt%2Fenum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartkonekt%2Fenum/lists"}