Download the PHP package shamaseen/laravel-repositories without Composer
On this page you can find all versions of the php package shamaseen/laravel-repositories. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shamaseen/laravel-repositories
More information about shamaseen/laravel-repositories
Files in shamaseen/laravel-repositories
Package laravel-repositories
Short Description repository pattern files generator
License MIT
Informations about the package laravel-repositories
Laravel-Repositories
A Laravel Repository generator with the best practice and tools already set and ready to be used.
What this package do?
- Commands to generate files, including repository files and others.
- Enforcing single responsibility principle
- Automatic CRUD out-of-the-box, whenever you generate a repository it will be CRUD-ready.
- Automatic query searching - (when the frontend send search GET param)
- Automatic query sorting - (when the frontend send order GET param)
- Automatic query filtration
Introduction
This package aim to provide auto file generation and base classes for the repository design pattern on Laravel.
Repository pattern forces you to have repository files in mediate between controllers and models, acting like a container where data access logic and business logic are stored.
What is wrong with the MVC pattern?
MVC Violate the single responsibility principle in SOLID principles, where controller methods are responsible for the business logic and returning responses to the front-end users in the same time, making it impossible to re-use these methods or to independently testing the business logic in them.
How repository design pattern works in this package?
After a request is being sent to the Laravel application, it follows these steps:
- The route catch the request and redirect it to its method in the controller
- The controller then validate the request with the correct request file.
- If the validations passed, the controller then check the policy authorization if available.
- If it passed the controller then call the repository to retrieve the required data.
- The repository implement the business logic and call the model to retrieve the required data from the database accordingly.
- The repository process that data (if needed) and return the final result to the controller
- The controller passes that data to the resource file to format the data as needed.
- The controller finally return the response back to the user.
Quick Usage
Run:
This will generate the following files:
- Test - (the Model file)
- TestController
- TestRepository
- TestRequest
- TestResource
- TestPolicy
- TestTest
Read the full document on ReadTheDoc.
LICENSE
MIT License
Versioning
We follow Semantic Versioning
Roadmap
- add the ability to disable caching from the config.
All versions of laravel-repositories with dependencies
shamaseen/laravel-files-generator Version ^0.5
laravel/framework Version >5.7