New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

jason-guru/laravel-make-repository

A simple package to create a make:repository command for Laravel 10, 11, and 12.
351,499 62
Install
composer require jason-guru/laravel-make-repository
Latest Version:v1.0.0
PHP:^8.1
Laravel:10 – 13
Older releases:5
License:MIT
Last Updated:Jun 1, 2026
Links: GitHub  ·  Packagist
Maintainer: Jason-Guru

Laravel PHP Artisan Make:Repository

Latest Stable Version Total Downloads Latest Unstable Version License

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

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

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

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

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

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

<?php

namespace App\Repositories;

use App\Models\User;
use App\Repositories\Contracts\UserRepositoryInterface;
use JasonGuru\LaravelMakeRepository\Repository\BaseRepository;

class UserRepository extends BaseRepository implements UserRepositoryInterface
{
    public function model(): string
    {
        return User::class;
    }
}

Related Packages

foothing/laravel-repository

This package provides an implementation of the repository pattern for Laravel 5.

2,307 4
giordanolima/eloquent-repository

Repository pattern for Eloquent ORM with a powerfull cache for database queries.

1,591 29
pierresilva/laravel-repository

Reusable Laravel repository interface.

126 1
lerouse/laravel-repository

Repository implementation for Laravel.

20,653 5
richan-fongdasen/eloquent-repository

An Eloquent Repository implementation in Laravel

13,908 0

Version History

Version Released PHP Laravel License
v1.0.0 ^8.1 ^10.0 || ^11.0 || ^12.0 || ^13.0 MIT
0.0.3 >=5.4.0 MIT
0.0.2 >=5.4.0 MIT
0.0.1 >=5.4.0 ~5.0 MIT