PHPackages                             jason-guru/laravel-make-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. [Database &amp; ORM](/categories/database)
4. /
5. jason-guru/laravel-make-repository

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

jason-guru/laravel-make-repository
==================================

A simple package to create a make:repository command for Laravel 10, 11, and 12.

v1.0.0(1mo ago)65316.9k↓52.9%32[2 issues](https://github.com/jason-guru/laravel-make-repository/issues)[1 PRs](https://github.com/jason-guru/laravel-make-repository/pulls)MITPHPPHP ^8.1

Since Oct 30Pushed 1mo agoCompare

[ Source](https://github.com/jason-guru/laravel-make-repository)[ Packagist](https://packagist.org/packages/jason-guru/laravel-make-repository)[ RSS](/packages/jason-guru-laravel-make-repository/feed)WikiDiscussions master Synced 3d ago

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

Laravel PHP Artisan Make:Repository
===================================

[](#laravel-php-artisan-makerepository)

[![Latest Stable Version](https://camo.githubusercontent.com/31eba35d7da2684fbfe024b8712e4ff049f1b560167c5c6d43dee826848b6511/68747470733a2f2f706f7365722e707567782e6f72672f6a61736f6e2d677572752f6c61726176656c2d6d616b652d7265706f7369746f72792f76657273696f6e)](https://packagist.org/packages/jason-guru/laravel-make-repository)[![Total Downloads](https://camo.githubusercontent.com/35d80a9517d2dc0d597e8939072e4d4f36091760ff66c3d74f11a9b25278b603/68747470733a2f2f706f7365722e707567782e6f72672f6a61736f6e2d677572752f6c61726176656c2d6d616b652d7265706f7369746f72792f646f776e6c6f616473)](https://packagist.org/packages/jason-guru/laravel-make-repository)[![Latest Unstable Version](https://camo.githubusercontent.com/9ca381b96306923d521cb8f5a8b3a6640e39cd1a34c7dd7993f59cb5c72da780/68747470733a2f2f706f7365722e707567782e6f72672f6a61736f6e2d677572752f6c61726176656c2d6d616b652d7265706f7369746f72792f762f756e737461626c65)](https://packagist.org/packages/jason-guru/laravel-make-repository)[![License](https://camo.githubusercontent.com/6c66ad59519cf5e3826a8c72249d5c1e8200088095f558b27b7c094d84448a9a/68747470733a2f2f706f7365722e707567782e6f72672f6a61736f6e2d677572752f6c61726176656c2d6d616b652d7265706f7369746f72792f6c6963656e7365)](https://packagist.org/packages/jason-guru/laravel-make-repository)

A simple package that adds a `php artisan make:repository` command to Laravel 10, 11, 12, and 13.

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

[](#installation)

Require the package with composer:

```
composer require jason-guru/laravel-make-repository --dev
```

Or add it to your `composer.json` `require-dev` section and run `composer update`:

```
"require-dev": {
    "jason-guru/laravel-make-repository": "^1.0"
}
```

Usage
-----

[](#usage)

```
php artisan make:repository your-repository-name
```

Example:

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

Or with a sub-namespace:

```
php artisan make:repository Backend\\UserRepository
```

Wire up a model in one shot with the `--model` (`-m`) option — the generated repository imports the model and returns it from `model()`:

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

The above commands create a `Repositories` directory inside the `app` directory.

Generated files
---------------

[](#generated-files)

By default, `make:repository UserRepository` creates **two** files:

- `app/Repositories/UserRepository.php` — the concrete class
- `app/Repositories/Contracts/UserRepositoryInterface.php` — the paired interface (extends `RepositoryContract`)

The concrete is declared `implements UserRepositoryInterface`, and the package's service provider auto-binds the interface to the concrete in the container — so you can type-hint the interface anywhere:

```
public function __construct(private UserRepositoryInterface $users) {}
```

To skip the interface for a single command, pass `--no-interface`:

```
php artisan make:repository UserRepository --no-interface
```

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

[](#configuration)

Publish the config to customize behavior:

```
php artisan vendor:publish --tag=repository-config
```

That creates `config/repository.php`:

```
return [
    'path'           => 'app/Repositories',
    'namespace'      => 'App\\Repositories',
    'with_interface' => true,  // generate a paired interface
    'bind'           => true,  // auto-bind interface => concrete
];
```

Example output
--------------

[](#example-output)

A repository generated with `--model=User` looks like this:

```
