PHPackages                             laraval-core-modules/service-repository - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. laraval-core-modules/service-repository

ActivePackages[Validation &amp; Sanitization](/categories/validation)

laraval-core-modules/service-repository
=======================================

This is a simple and extensible package for improving development time via service and repository for Laravel.

1.0.1(3y ago)232MITPHPPHP ^8.1

Since Apr 27Pushed 3y agoCompare

[ Source](https://github.com/laravel-core-modules/laravel-service-repository)[ Packagist](https://packagist.org/packages/laraval-core-modules/service-repository)[ Docs](http://github.com/laravel-core-modules/laravel-service-repository)[ RSS](/packages/laraval-core-modules-service-repository/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (18)Versions (5)Used By (0)

[![Laravel Service Repository](https://raw.githubusercontent.com/nunomaduro/larastan/master/docs/logo.png?sanitize=true)](https://raw.githubusercontent.com/nunomaduro/larastan/master/docs/logo.png?sanitize=true)

[![Build Status](https://camo.githubusercontent.com/a1c7cc93707cec45e18bed45a1c24056af47582dac99b25c61e40f64a876d495/68747470733a2f2f7472617669732d63692e6f72672f42656e53616d706f2f6c61726176656c2d656e756d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/BenSampo/laravel-enum)[![Packagist Stable Version](https://camo.githubusercontent.com/6da6b16e01f91259f035bc88f0227453e33a922c9828e6b9db008e97e59b851d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61726176656c2d636f72652d6d6f64756c65732f6c61726176656c2d736572766963652d7265706f7369746f72792e7376673f7374796c653d666c61742d737175617265266c6162656c3d737461626c65)](https://packagist.org/packages/laravel-core-modules/laravel-service-repository)[![Packagist downloads](https://camo.githubusercontent.com/b7d26a7e847c01022f34a2de6f2b00641b8aa26bb59b582931bfe625ed5f29bb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61726176656c2d636f72652d6d6f64756c65732f6c61726176656c2d736572766963652d7265706f7369746f72792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-core-modules/laravel-service-repository)[![MIT Software License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE)

About Laravel Service Repository
--------------------------------

[](#about-laravel-service-repository)

This is a simple and extensible package for improving development time via service and repository for Laravel.

- Enum key value pairs as class constants
- Full-featured suite of methods
- Enum instantiation
- Flagged/Bitwise enums
- Type hinting
- Attribute casting
- Enum artisan generator
- Validation rules for passing enum key or values as input parameters
- Localization support
- Extendable via Macros

Created by [Corine BOCOGA](https://corine.b.github)

Official Documentation
----------------------

[](#official-documentation)

Documentation for ServiceRepository can be found on the [packages.tools/testbench](https://packages.tools/laravel-core-modules/laravel-service-repository).

Jump To
-------

[](#jump-to)

- [Guide](#guide)
- [Installation](#installation)
- [Enum Library](enum-library.md)
- [Basic Usage](#basic-usage)
    - [Enum definition](#enum-definition)
    - [Instantiation](#instantiation)
    - [Instance Properties](#instance-properties)
    - [Instance Equality](#instance-equality)
    - [Type Hinting](#instance-equality)
- [Flagged/Bitwise Enum](#flaggedbitwise-enum)
- [Attribute Casting](#attribute-casting)
- [Migrations](#migrations)
- [Validation](#validation)
- [Localization](#localization)
- [Customizing descriptions](#customizing-descriptions)
- [Extending the Enum Base Class](#extending-the-enum-base-class)
- [Laravel Nova Integration](#laravel-nova-integration)
- [PHPStan Integration](#phpstan-integration)
- [Artisan Command List](#artisan-command-list)
- [Enum Class Reference](#enum-class-reference)
- [Stubs](#stubs)

Documentation for older versions
--------------------------------

[](#documentation-for-older-versions)

You are reading the documentation for `6.x`.

- If you're using **Laravel 8** please see the [docs for `4.x`](https://github.com/BenSampo/laravel-enum/blob/v4.2.0/README.md).
- If you're using **Laravel 7** please see the [docs for `2.x`](https://github.com/BenSampo/laravel-enum/blob/v2.2.0/README.md).
- If you're using **Laravel 6** or below, please see the [docs for `1.x`](https://github.com/BenSampo/laravel-enum/blob/v1.38.0/README.md).

Please see the [upgrade guide](./UPGRADE.md) for information on how to upgrade to the latest version.

Guide
-----

[](#guide)

I wrote a blog post about using laravel-enum:

Installation
------------

[](#installation)

### Requirements

[](#requirements)

- Laravel `10` or higher
- PHP `8.1` or higher

Via Composer

```
composer require laravel-core-modules/laravel-service-repository
```

Enum Library
------------

[](#enum-library)

Browse and download from a list of commonly used, community contributed enums.

[Enum library →](enum-library.md)

Basic Usage
-----------

[](#basic-usage)

### Enum Definition

[](#enum-definition)

You can use the following Artisan command to generate a new enum class:

```
php artisan make:enum UserType
```

Now, you just need to add the possible values your enum can have as constants.

```
