PHPackages                             irfan-chowdhury/repository-maker - 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. irfan-chowdhury/repository-maker

ActiveLibrary

irfan-chowdhury/repository-maker
================================

This package will generate the necessary files for the repository design pattern environment.

v1.2.0(2y ago)513MITPHPPHP &gt;=7.4

Since Aug 17Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Irfan-Chowdhury/repository-maker)[ Packagist](https://packagist.org/packages/irfan-chowdhury/repository-maker)[ Docs](https://github.com/Irfan-Chowdhury/repository-maker)[ RSS](/packages/irfan-chowdhury-repository-maker/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (8)Used By (0)

Laravel Repository Maker
========================

[](#laravel-repository-maker)

About Repository Design Pattern:
--------------------------------

[](#about-repository-design-pattern)

The Repository Design Pattern is a software design principle commonly used in the development of applications that interact with data storage systems, such as databases. It provides an abstraction layer between the application's data access logic and the underlying data storage, promoting separation of concerns and modularity in the codebase.

In short, the Repository Design Pattern involves creating classes or interfaces called repositories, which encapsulate the methods and operations for interacting with the data storage. These repositories abstract away the details of how data is retrieved, stored, and manipulated, making the application's codebase more maintainable and testable. This pattern also helps in centralizing data access logic, improving code reusability, and facilitating the management of complex queries.

Requirement:
------------

[](#requirement)

```
    "require": {
        "php": ">=7.4",
        "laravel/framework": ">=8.0"
    }
```

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

[](#installation)

You can install the package via composer:

```
composer require irfan-chowdhury/repository-maker
```

Setup
-----

[](#setup)

After installation goto `config/app.php` and paste the bellow line in "providers" array

```
'providers' => [
    /*
    * Package Service Providers...
    */
    Irfan\RepositoryMaker\RepositoryServiceProvider::class,
]
```

Usage
-----

[](#usage)

If you now run `php artisan` you will see some new commands in the list:

- `make:contract`
- `make:contract-base`
- `make:contract-extends`
- `make:repository`
- `make:repository-i`
- `make:repository-base`
- `make:repository-extends`
- `make:service`
- `make:repository-i-s`

### Commands

[](#commands)

```
$ php artisan make:contract NameContract
$ php artisan make:contract-base
$ php artisan make:contract-extends NameContract
$ php artisan make:repository NameRepository
$ php artisan make:repository-i NameRepository
$ php artisan make:repository-base
$ php artisan make:repository-extends NameRepository
$ php artisan make:service NameService
$ php artisan make:repository-i-s NameRepository
```

### Note:

[](#note)

- *Before using repository you have to ensure that your model class exists or not.*
- *You have to register the dependency in `register()` method in `AppServiceProvider`. If you want you can create a custom service provider. Following the bellow code -*

```
use App\Contracts\NameContract;
use App\Repositories\NameRepository;

...

public function register(): void
{
    $this->app->bind(NameContract::class, NameRepository::class);
}
```

Example
-------

[](#example)

Let you have a User Model according to this namespace `App\Models\User.php`

### Creating Interface

[](#creating-interface)

it will generate an interface according to this path `app/Contracts/UserContract.php`. Here we named this interface as Contract.

```
$ php artisan make:contract UserContract
```

### Creating a Base Interface

[](#creating-a-base-interface)

It is optional but if you want to use a base, it will generate an interface according to this path `app/Contracts/BaseContract.php`. Here we named this interface as Contract.

```
$ php artisan make:contract-base
```

### Creating an Interface with extends Base Interface

[](#creating-an-interface-with-extends-base-interface)

If you want to extends with the Base Interface, it will generate an interface according to this path `app/Contracts/UserContract.php` and extends with `BaseContract`.

```
$ php artisan make:contract-extends UserContract
```

Note: But before using extends with the Base interface, you have to create a BaseContract before (using only `make:contract-base`).

### Creating Repository

[](#creating-repository)

It will generate a repository class according to this path `app/Repositories/UserRepository.php`.

```
$ php artisan make:repository UserRepository
```

### Creating Repository with interface

[](#creating-repository-with-interface)

It will generate a repository class with interface according to this path `app/Repositories/UserRepository.php` and `app/Contracts/UserContract.php`.

```
$ php artisan make:repository-i UserRepository
```

### Creating a Base Repository

[](#creating-a-base-repository)

It is optional but if you want to use a base, it will generate a repository class according to this path `app/Repositories/BaseRepository.php`.

```
$ php artisan make:repository-base
```

### Creating a Repository with extends the Base Repository

[](#creating-a-repository-with-extends-the-base-repository)

If you want to extends with Base Repository, it will generate a Repository class according to this path `app/Repositories/UserRepository.php` and extends with `BaseRepository`.

```
$ php artisan make:repository-extends UserRepository
```

Note: But before using extends with the Base repository, you have to create a BaseRepository class before (using only `make:repository-base`).

### Creating Service Class

[](#creating-service-class)

It is optional but sometimes we need to use a service class to maintain business logic. If you want to use a service class, it will generate a service class according to this path `app/Services/UserService.php`.

```
$ php artisan make:service UserService
```

### Creating Repository with interface and service

[](#creating-repository-with-interface-and-service)

It will generate a repository class with interface and service according to this path `app/Repositories/UserRepository.php`, `app/Contracts/UserContract.php`, `app/Services/UserService.php`.

```
$ php artisan make:repository-i-s UserRepository
```

After then you have to register in a service provider - ```
use App\Contracts\UserContract;
use App\Repositories\UserRepository;

...

public function register(): void
{
    $this->app->bind(UserContract::class, UserRepository::class);
}
```

### Inject in Controller/Service class

[](#inject-in-controllerservice-class)

In your controlleror, you can use them,

```
use App\Contracts\UserContract;
...

public function __construct(public UserContract $userContract){}

public function index()
{
    return $userContract->latest()->first();
}
```

Visit
-----

[](#visit)

Packagist :

Credits
-------

[](#credits)

- Inspired by [Abdullah Al Zuhair](https://github.com/zuhair2025)
- Resources - [Bitfumes](https://www.youtube.com/@Bitfumes) and [Maniruzzaman Akash](https://www.youtube.com/@Maniruzzaman)
- Structure follow from - [spatie/package-skeleton-laravel](https://github.com/spatie/package-skeleton-laravel)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 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

Every ~1 days

Total

7

Last Release

995d ago

Major Versions

v0.1.4 → v1.0.02023-08-17

PHP version history (2 changes)v0.1.0PHP ^7.4|^8.0

v0.1.4PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/8ba41761494aa6c0e083c839276610c1cf14dd3fb4c6ed2a65228aa377b5746d?d=identicon)[Irfan-Chowdhury](/maintainers/Irfan-Chowdhury)

---

Top Contributors

[![Irfan-Chowdhury](https://avatars.githubusercontent.com/u/32363317?v=4)](https://github.com/Irfan-Chowdhury "Irfan-Chowdhury (19 commits)")

---

Tags

laravel-repositorylaravel-repository-design-patternrepositoryrepository-design-patternrepositorylaravel-repositorylaravel-Repository-design-patternrepository-design-pattern

### Embed Badge

![Health badge](/badges/irfan-chowdhury-repository-maker/health.svg)

```
[![Health](https://phpackages.com/badges/irfan-chowdhury-repository-maker/health.svg)](https://phpackages.com/packages/irfan-chowdhury-repository-maker)
```

###  Alternatives

[orkhanahmadov/eloquent-repository

Eloquent Repository for Laravel

2764.5k](/packages/orkhanahmadov-eloquent-repository)[adobrovolsky97/laravel-repository-service-pattern

Laravel 5|6|7|8|9|10 - Repository - Service Pattern

275.4k](/packages/adobrovolsky97-laravel-repository-service-pattern)[scrumble-nl/laravel-csr

This package makes it possible to generate a controller, service, repository, model and migration all in 1 command

4219.2k](/packages/scrumble-nl-laravel-csr)

PHPackages © 2026

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