PHPackages                             taha-davari/laravel-easy-service-repo - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. taha-davari/laravel-easy-service-repo

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

taha-davari/laravel-easy-service-repo
=====================================

A Laravel package to easily generate service and repository classes with interfaces.

0.0.1(1y ago)03MITPHPPHP ^8.0

Since Oct 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/tahadavari/laravel-easy-service-repo)[ Packagist](https://packagist.org/packages/taha-davari/laravel-easy-service-repo)[ RSS](/packages/taha-davari-laravel-easy-service-repo/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

### README for LaravelEasyServiceRepo

[](#readme-for-laraveleasyservicerepo)

---

LaravelEasyServiceRepo
======================

[](#laraveleasyservicerepo)

**LaravelEasyServiceRepo** is a Laravel package that helps you quickly generate service and repository classes along with their interfaces. This package simplifies the structure of your Laravel applications by providing convenient Artisan commands to create repositories and services with ease.

Features
--------

[](#features)

- Generate repository and service classes with interfaces via Artisan commands.
- Automatically inject the repository into the service class.
- Support for polymorphic relationships in repositories.
- Automatically register the created services and repositories with the Laravel IoC container.

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

[](#installation)

To get started, install the package via Composer:

```
composer require your-namespace/laravel-easy-service-repo
```

After installation, the package will automatically register the following service providers:

- `ServiceServiceProvider`
- `RepositoryServiceProvider`

These providers are responsible for automatically binding services and repositories to the Laravel service container.

Usage
-----

[](#usage)

This package provides three Artisan commands that help you generate services and repositories quickly:

### 1. `make:service {name}`

[](#1-makeservice-name)

Generates a new service class with an interface.

#### Example:

[](#example)

```
php artisan make:service User
```

This command will generate the following files:

- `app/Services/User/IUserService.php` (Service Interface)
- `app/Services/User/UserService.php` (Service Implementation)

### 2. `make:repository {name} {--model=}`

[](#2-makerepository-name---model)

Generates a new repository class with an interface. Optionally, you can specify the model that this repository will handle.

#### Example:

[](#example-1)

```
php artisan make:repository User --model=User
```

This command will generate the following files:

- `app/Repositories/User/IUserRepository.php` (Repository Interface)
- `app/Repositories/User/UserRepository.php` (Repository Implementation)

### 3. `make:service-repository {name}`

[](#3-makeservice-repository-name)

This command creates both the service and repository for the given name, and automatically injects the repository into the service class.

#### Example:

[](#example-2)

```
php artisan make:service-repository User
```

This command will generate the following:

- Service and repository with their interfaces.
- Inject the repository into the service class.

After running the command, the generated service class will look like this:

```
namespace App\Services\User;

use App\Repositories\User\IUserRepository;

class UserService implements IUserService
{
    protected IUserRepository $userRepository;

    public function __construct(IUserRepository $userRepository)
    {
        $this->userRepository = $userRepository;
    }
}
```

Service and Repository Providers
--------------------------------

[](#service-and-repository-providers)

Two service providers, `ServiceServiceProvider` and `RepositoryServiceProvider`, are responsible for registering the service and repository classes with Laravel's IoC container.

These providers automatically scan the `app/Services/` and `app/Repositories/` directories for service and repository interfaces and bind them to their corresponding implementations.

### Custom Service and Repository Binding

[](#custom-service-and-repository-binding)

If you need to add custom binding logic, you can modify the service providers or override them by manually registering your classes in `AppServiceProvider` or any other provider in your application.

Example
-------

[](#example-3)

Here’s an example of how to use the generated service and repository:

```
use App\Services\User\IUserService;

class UserController extends Controller
{
    protected IUserService $userService;

    public function __construct(IUserService $userService)
    {
        $this->userService = $userService;
    }

    public function index()
    {
        $users = $this->userService->getAllUsers();
        return response()->json($users);
    }
}
```

In the above example, `IUserService` is injected into the controller, and the service uses the `IUserRepository` to retrieve data from the database.

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

[](#contributing)

Contributions are welcome! Please submit a pull request or create an issue to discuss any changes.

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE.md).

---

### Conclusion

[](#conclusion)

**LaravelEasyServiceRepo** is designed to make it easy for you to generate services and repositories in a clean and maintainable structure for your Laravel application. Start using it today to speed up your development process!

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Unknown

Total

1

Last Release

577d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/93b1670577ffc24f130675327f2397f6d42c69c8803e3ed4c03b786b18ec88b9?d=identicon)[tahadavari](/maintainers/tahadavari)

---

Top Contributors

[![tahadavari](https://avatars.githubusercontent.com/u/77568584?v=4)](https://github.com/tahadavari "tahadavari (8 commits)")

### Embed Badge

![Health badge](/badges/taha-davari-laravel-easy-service-repo/health.svg)

```
[![Health](https://phpackages.com/badges/taha-davari-laravel-easy-service-repo/health.svg)](https://phpackages.com/packages/taha-davari-laravel-easy-service-repo)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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