Internal enum values | enum | Spatie

 SPATIE

enum
====

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Enum](https://spatie.be/docs/enum/v3)  Usage  Internal enum values

 Version   v3   v2   v1

 Other versions for crawler [v3](https://spatie.be/docs/enum/v3) [v2](https://spatie.be/docs/enum/v2) [v1](https://spatie.be/docs/enum/v1)

  Internal enum values
- [ Introduction ](https://spatie.be/docs/enum/v3/introduction)
- [ Postcardware ](https://spatie.be/docs/enum/v3/postcardware)
- [ Installation and setup ](https://spatie.be/docs/enum/v3/installation-and-setup)
- [ Questions &amp; issues ](https://spatie.be/docs/enum/v3/questions-and-issues)
- [ Changelog ](https://spatie.be/docs/enum/v3/changelog)
- [ About us ](https://spatie.be/docs/enum/v3/about-us)

Usage
-----

- [ Internal enum values ](https://spatie.be/docs/enum/v3/usage/2-internal-enum-values)
- [ Overriding enum values ](https://spatie.be/docs/enum/v3/usage/3-overriding-enum-values)
- [ Overriding enum labels ](https://spatie.be/docs/enum/v3/usage/4-overriding-enum-labels)
- [ Comparing enums ](https://spatie.be/docs/enum/v3/usage/5-comparing-enums)
- [ Laravel ](https://spatie.be/docs/enum/v3/usage/100-laravel)

 Internal enum values
====================

Creating enums from serialized values is done like so:

```
$status = new StatusEnum('draft');
```

When an enum value doesn't exist, you'll get an error.

Also keep in mind that the core philosophy of this package is that you should *never* use the enum value directly in your code. Always use the object itself. The only place where you're allowed to use `Enum::make()` is to unserialise a value into an enum object. One example is to convert a stored value in a database to an enum object.

If you want to get the value of an enum to store it, you can do this:

```
$status->value;
```

Note that `value` is a read-only property, it cannot be changed.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
