https://github.com/lamoda/php-enum-bundle
Utility wrapper for https://github.com/paillechat/php-enum
https://github.com/lamoda/php-enum-bundle
bundle enum php php-enum-bundle
Last synced: about 1 year ago
JSON representation
Utility wrapper for https://github.com/paillechat/php-enum
- Host: GitHub
- URL: https://github.com/lamoda/php-enum-bundle
- Owner: lamoda
- License: mit
- Created: 2018-07-11T15:05:39.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-02-15T11:07:26.000Z (over 2 years ago)
- Last Synced: 2025-03-24T15:42:05.434Z (over 1 year ago)
- Topics: bundle, enum, php, php-enum-bundle
- Language: PHP
- Size: 26.4 KB
- Stars: 10
- Watchers: 31
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lamoda PHP Enum bundle
Utility wrapper for https://github.com/paillechat/php-enum
## Installation
Usage is as simple as
```bash
composer require lamoda/enum-bundle:^1.0
```
```php
// Kernel
public function registerBundles()
{
// ...
$bundles[] = new \Lamoda\EnumBundle\LamodaEnumBundle();
// ...
}
```
```yaml
# config.yml
lamoda_enum:
dbal_types:
# short example
my_domain_enum: My\Domain\Enum
# full example
my_domain_enum_2:
class: My\Domain\Enum
# identical strategy saves enum as its name as is, no conversion
# lowercase strategy converts enum name to lowercase and vice versa on fetch
strategy: identical
```
```php
class MyEntity
{
/** @ORM\Column(type="my_domain_enum") */
private $value;
}
```
This will enable conversion of value field from your enum