PHPackages                             saritasa/laravel-entity-services - 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. [Database &amp; ORM](/categories/database)
4. /
5. saritasa/laravel-entity-services

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

saritasa/laravel-entity-services
================================

Saritasa entity service for typical CRUD operations

2.0.0(1y ago)014.7k↓50%[1 issues](https://github.com/Saritasa/php-laravel-entity-services/issues)[1 PRs](https://github.com/Saritasa/php-laravel-entity-services/pulls)1MITPHPPHP &gt;=8.0

Since Jun 7Pushed 1y ago8 watchersCompare

[ Source](https://github.com/Saritasa/php-laravel-entity-services)[ Packagist](https://packagist.org/packages/saritasa/laravel-entity-services)[ RSS](/packages/saritasa-laravel-entity-services/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (13)Used By (1)

Laravel Entity Services
=======================

[](#laravel-entity-services)

[![PHP Unit](https://github.com/Saritasa/php-laravel-entity-services/workflows/PHP%20Unit/badge.svg)](https://github.com/Saritasa/php-laravel-entity-services/actions)[![PHP CodeSniffer](https://github.com/Saritasa/php-laravel-entity-services/workflows/PHP%20Codesniffer/badge.svg)](https://github.com/Saritasa/php-laravel-entity-services/actions)[![codecov](https://camo.githubusercontent.com/2dcb21d9c7d5f72dde7ca8c36c5f7e333cb77becae5168291a11a951f400921d/68747470733a2f2f636f6465636f762e696f2f67682f53617269746173612f7068702d6c61726176656c2d656e746974792d73657276696365732f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/Saritasa/php-laravel-entity-services)[![PHPv](https://camo.githubusercontent.com/f287f3bb0d9abc9ee972098530f6ccc1ef88787909e017013e63c29a753dff7b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f73617269746173612f6c61726176656c2d656e746974792d73657276696365732e737667)](http://www.php.net)[![Downloads](https://camo.githubusercontent.com/626eb14171c59ab7928c87a51cd6265fc16f237af7ca9ff1785d18d825b4b6c2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73617269746173612f6c61726176656c2d656e746974792d73657276696365732e737667)](https://packagist.org/packages/saritasa/laravel-entity-services)

Library for fast build laravel based application with simple CRUD operations.
-----------------------------------------------------------------------------

[](#library-for-fast-build-laravel-based-application-with-simple-crud-operations)

As Repositories layer uses [laravel-repositories](https://github.com/Saritasa/php-laravel-repositories) library.

Laravel 5.5/6.0
---------------

[](#laravel-5560)

Install the `saritasa/laravel-entity-services` package:

```
bash $ composer require saritasa/laravel-entity-services ```
## Usage
### Get service for model:
 ```php
 $entityServiceFactory = app(IEntityServiceFactory::class);
 $entityService = $entityServiceFactory->build(User::class);

```

\*Note: if entity class not exists, EntityServiceException will be thrown

Configuration
-------------

[](#configuration)

### Publish file

[](#publish-file)

To publish configuration file you can run next command:

```
php artisan vendor:publish --tag=laravel_entity_services
```

It will copy file laravel\_entity\_services.php in config directory.

### Register custom entity service implementation

[](#register-custom-entity-service-implementation)

To register your own IEntityService implementation you can put it into configuration file, like:

```
return [
 'bindings' => [\App\Models\User::class => \App\EntityServices\UserEntityService::class,],];
```

NOTE: Just remember that default IEntityServiceFactory implementation can work only with classes extended from EntityService. If you want change this behavior you should add your own implementation.

### Available operations:

[](#available-operations)

#### Create:

[](#create)

```
 $createdModel = $entityService->create($params);
```

#### Update:

[](#update)

`php $entityService->update($model, $params); `

#### Delete:

[](#delete)

`php $entityService->delete($model); `

### Custom service for entity:

[](#custom-service-for-entity)

If you need use custom service for some entity, you can register it in factory using `register` method.

**Example**:

```
 $entityServiceFactory = app(IEntityServiceFactory::class);
 $entityService = $entityServiceFactory->register(User::class, YourServiceRealization::class);
```

*Note: Your realization must be extend EntityService class*

### Events

[](#events)

EntityCreatedEvent - Throws when entity is created.
EntityUpdatedEvent - Throws when entity is updated.
EntityDeletedEvent - Throws when entity is deleted.

Contributing
------------

[](#contributing)

1. Create fork, checkout it
2. Develop locally as usual. **Code must follow [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/)** -
    run [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) to ensure, that code follows style guides
3. **Cover added functionality with unit tests** and run [PHPUnit](https://phpunit.de/) to make sure, that all tests pass
4. Update [README.md](README.md) to describe new or changed functionality
5. Add changes description to [CHANGES.md](CHANGES.md) file. Use [Semantic Versioning](https://semver.org/) convention to determine next version number.
6. When ready, create pull request

### Make shortcuts

[](#make-shortcuts)

If you have [GNU Make](https://www.gnu.org/software/make/) installed, you can use following shortcuts:

- `make cs` (instead of `php vendor/bin/phpcs`) -
    run static code analysis with [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)
    to check code style
- `make csfix` (instead of `php vendor/bin/phpcbf`) -
    fix code style violations with [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)
    automatically, where possible (ex. PSR-2 code formatting violations)
- `make test` (instead of `php vendor/bin/phpunit`) -
    run tests with [PHPUnit](https://phpunit.de/)
- `make install` - instead of `composer install` \* `make all` or just `make` without parameters -
    invokes described above **install**, **cs**, **test** tasks sequentially -
    project will be assembled, checked with linter and tested with one single command

Resources
---------

[](#resources)

- [Bug Tracker](http://github.com/saritasa/php-laravel-entity-services/issues)
- [Code](http://github.com/saritasa/php-laravel-entity-services)
- [Changes History](CHANGES.md)
- [Authors](http://github.com/saritasa/php-laravel-entity-services/contributors)

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~250 days

Recently: every ~493 days

Total

10

Last Release

643d ago

Major Versions

1.5.0 → 2.0.02024-08-07

PHP version history (2 changes)1.0PHP &gt;=7.1

2.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/b7632cf2eb5dd552ace9d66947ed6919e19c6a2fdb5dc73b8c71e0f9886ccc83?d=identicon)[saritasa](/maintainers/saritasa)

---

Top Contributors

[![maxermolenko](https://avatars.githubusercontent.com/u/11438109?v=4)](https://github.com/maxermolenko "maxermolenko (6 commits)")[![populov](https://avatars.githubusercontent.com/u/3766033?v=4)](https://github.com/populov "populov (3 commits)")[![veeeeeRySeXy](https://avatars.githubusercontent.com/u/10694924?v=4)](https://github.com/veeeeeRySeXy "veeeeeRySeXy (3 commits)")[![hollow-en](https://avatars.githubusercontent.com/u/87475798?v=4)](https://github.com/hollow-en "hollow-en (2 commits)")

---

Tags

laravelphpphplaravelsaritasa

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/saritasa-laravel-entity-services/health.svg)

```
[![Health](https://phpackages.com/badges/saritasa-laravel-entity-services/health.svg)](https://phpackages.com/packages/saritasa-laravel-entity-services)
```

###  Alternatives

[spiritix/lada-cache

A Redis based, automated and scalable database caching layer for Laravel

591444.8k2](/packages/spiritix-lada-cache)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2031.2M2](/packages/glushkovds-phpclickhouse-laravel)[io238/laravel-iso-countries

Ready-to-use Laravel models and relations for country (ISO 3166), language (ISO 639-1), and currency (ISO 4217) information with multi-language support.

5462.3k](/packages/io238-laravel-iso-countries)[sebastiaanluca/laravel-boolean-dates

Automatically convert Eloquent model boolean attributes to dates (and back).

40111.7k1](/packages/sebastiaanluca-laravel-boolean-dates)[inani/larapoll

A Laravel package to create polls

25517.7k1](/packages/inani-larapoll)[matchory/elasticsearch

The missing elasticsearch ORM for Laravel!

3059.0k](/packages/matchory-elasticsearch)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
