fatihrizqon / laravel-service-repo-generator
Artisan command to generate Service & Repository in Laravel
Package info
github.com/fatihrizqon/laravel-service-repo-generator
pkg:composer/fatihrizqon/laravel-service-repo-generator
v1.0.0
2026-01-02 04:34 UTC
Requires
- php: ^8.2
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^9.0
README
An Artisan command to generate Service & Repository pattern in Laravel projects, complete with interfaces and customizable stubs.
✨ Features
- Generate Service & Service Interface
- Generate Repository & Repository Interface
- Configurable namespaces
- Customizable stubs via
vendor:publish - Laravel auto-discovery support
- Compatible with Laravel 10, 11, and 12
📦 Installation
Install the package via Composer:
composer require fatihrizqon/laravel-service-repo-generator
The service provider will be automatically registered via Laravel auto-discovery.
⚙️ Publish Configuration
(Optional but recommended)
php artisan vendor:publish --tag=service-repo-generator-config
The configuration file will be published to:
config/service-repo-generator.php
🧱 Publish Stubs (Customize Templates)
To customize the service and repository templates:
php artisan vendor:publish --tag=service-repo-generator-stubs
The stubs will be published to:
stubs/service-repo-generator/
🚀 Usage
Generate a Service
php artisan create:service User
This command will generate:
app/Services/UserService.php
app/Services/Interfaces/IUserService.php
Generate a Repository
php artisan create:repository User
This command will generate:
app/Repositories/UserRepository.php
app/Repositories/Interfaces/IUserRepository.php
🛠 Configuration Example
return [ 'service_namespace' => 'Services', 'service_interface_namespace' => 'Services\\Interfaces', 'repository_namespace' => 'Repositories', 'repository_interface_namespace' => 'Repositories\\Interfaces', ];
📄 License
MIT License © 2025
Created by Fatih Rizqon