Download the PHP package sagni/repository without Composer
On this page you can find all versions of the php package sagni/repository. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sagni/repository
More information about sagni/repository
Files in sagni/repository
Package repository
Short Description This is laravel package for creating repository
License MIT
Informations about the package repository
Table of Contents
- Overview
- Installation
- Requirements
- Install the Package
- Usage
- Contribution
- License
- Conclusion
OverView
This is a lightweight Laravel package designed to streamline the process of creating repositories design pattern in your projects. With this package, you can effortlessly generate the necessary files for your repository, including the concrete class, interface, and service provider.
Installation
Requirements
The package has been developed and tested to work with the following minimum requirements:
- PHP 8.0
- Laravel 8
Install the Package
Run this command
Usage
Basic Usage
To create a repository using the make:repository command, simply run:
If the Repository directory does not exist within your app directory, the command will automatically create it for you. The above command will generate the following files:
- app/Repository/User/UserRepository.php
- app/Repository/User/UserRepositoryInterface.php
- app/Providers/User/UserRepositoryServiceProvider.php
If you prefer to keep the generated repository files directly in the app/Repository directory without any subdirectory, you can use the command below:
This command generates the same files mentioned above, but without the User subdirectory.
Repository Class
After generating the necessary files, you need to implement your repository logic. Open the UserRepository.php file created inside the app/Repository/User directory and modify it as needed:
Repository Interface
Edit the UserRepositoryInterface.php file inside the app/Repository/User directory to define the repository methods:
Service Provider
The UserRepositoryServiceProvider.php file located in app/Providers/User binds the repository interface to its implementation. You don't need to modify this file, as it's automatically generated.
And the following will be automatically added in your project's config/app.php
Contribution
If you wish to make any changes or improvements to the package, feel free to make a pull request.
License
The MIT License (MIT). Please see License File for more information.
Conclusion
The Sagni Repository package greatly simplifies the process of creating repository classes in your Laravel application. By automating the generation of repository files, interfaces, and service providers, it encourages a structured and organized approach to data access. Feel free to expand on the base implementation to tailor it to your project's specific needs.
If you have any questions, feedback, or contributions, please don't hesitate to reach out to the package author:
- Author: Sagni Alemayehu
- Email: [email protected]
All versions of repository with dependencies
illuminate/console Version ^8.0|^9.0|^10.0
symfony/console Version ^5.0|^6.0
illuminate/support Version ^8.0|^9.0|^10.0