Download the PHP package techrays-labs/laravel-service-repository-generator without Composer
On this page you can find all versions of the php package techrays-labs/laravel-service-repository-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download techrays-labs/laravel-service-repository-generator
More information about techrays-labs/laravel-service-repository-generator
Files in techrays-labs/laravel-service-repository-generator
Package laravel-service-repository-generator
Short Description A powerful and flexible Laravel package that simplifies the implementation of the Service-Repository design pattern. Generate Service and Repository classes with ease, customize their namespace and path, and streamline your application's architecture.
License MIT
Informations about the package laravel-service-repository-generator
Laravel Service & Repository Generator
A powerful and flexible Laravel package that simplifies the implementation of the Service-Repository design pattern. Generate Service and Repository classes with ease, customize their namespace and path, and streamline your application's architecture. Perfect for developers who follow clean code principles and want a structured approach to business logic and data handling in Laravel applications.
Features
- Generate Service & Repository classes automatically
- Supports custom namespaces & paths
- Option to generate a Repository Interface
- Automatic binding in
AppServiceProvider
- Uses stub files for customization
- Publishable configuration file
- Compatible with Laravel 8, 9, and 10
Installation
Install via Composer
Publish the configuration file
Publish the stub files (optional)
Configuration
The package allows you to define default namespaces and paths in config/service-repository.php
You can modify these settings to match your project structure.
Usage
Basic Usage
Generate a Service & Repository for User
This will create
Custom Namespace for Service
This will place the service in Domain\Services
Custom Path for Repository
This will place the repository in Domain\Repositories
Generate Repository Interface
This will generate an interface alongside the repository
Combine Multiple Options
This will generate
Stubs Customization
After publishing the stub files, you can find them in stubs/service-repository-generator/
Modify these stubs to customize the generated files
service.stub
– Template for service classrepository.stub
– Template for repository classrepository-interface.stub
– Template for repository interface
Example of a custom service stub (service.stub
)
Automatic Binding in Service Provider
If you generate an interface, the package automatically binds it in AppServiceProvider.php
Example Usage in Code
Inject Service into a Controller
Use Repository in a Service
Contributing
Want to improve this package? Contributions are welcome!
- Fork the repository
- Create a new branch
feature/awesome-feature
- Commit your changes
- Push the branch
- Submit a Pull Request
License
This package is open-sourced software licensed under the MIT License.
Happy Coding! 🎉