Download the PHP package rakib-587/laravel-make-repository without Composer
On this page you can find all versions of the php package rakib-587/laravel-make-repository. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rakib-587/laravel-make-repository
More information about rakib-587/laravel-make-repository
Files in rakib-587/laravel-make-repository
Package laravel-make-repository
Short Description Laravel Artisan command to generate repositories with optional model binding.
License MIT
Informations about the package laravel-make-repository
Laravel Make Repository
A lightweight Laravel package that provides Artisan commands to generate Repository classes following a clean and extendable pattern. Supports optional model binding and integrated model creation.
📦 Installation
Require the package via Composer:
If you're using Laravel <10 and auto-discovery doesn't work, manually register the service provider in config/app.php
:
⚙️ Usage
➤ Create a Repository for an Existing Model
This will generate:
app/Repositories/UserRepository.php
- Uses
App\Models\User
as the associated model (automatically inferred)
➤ Create a Repository with an Explicit Model
This allows you to manually specify the model class to be used inside the repository.
➤ Create a Model with a Repository in One Command
This command:
- Creates
app/Models/Product.php
- Creates
app/Repositories/ProductRepository.php
- Links the repository to the model automatically
🧩 Customizing the Stub
The repository class is generated using a stub file that defines its structure and placeholders.
By default, the command looks for a local stub file in your Laravel project:
If the file does not exist, it will gracefully fall back to using the default stub provided by the package.
✏️ How to Customize
To customize the repository structure, first publish the stub file into your project:
This will copy the stub to:
You can now edit the stub to change the generated structure.
Available placeholders:
{{ ClassName }}
— The name of the generated repository class (e.g.,UserRepository
){{ ModelName }}
— The associated model class (e.g.,User
)
Once the stub exists in your project, it will automatically be used for all future repository generations.
📁 Output Structure Example
When you run:
You'll get:
📄 License
This package is open-sourced software licensed under the MIT license.
🙌 Author
Md Rakibul Islam
GitHub: @rakib-587