Download the PHP package vxsoft/laravel-repository without Composer
On this page you can find all versions of the php package vxsoft/laravel-repository. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vxsoft/laravel-repository
More information about vxsoft/laravel-repository
Files in vxsoft/laravel-repository
Package laravel-repository
Short Description Laravel Repository is a powerful Laravel package designed to simplify the interaction with Eloquent models by implementing a repository-based architecture. It separates the data persistence logic from the application's business logic, promoting a clean, maintainable, and testable codebase.
License MIT
Informations about the package laravel-repository
Laravel Repository Package
Author: Bikas Chaudhary [email protected]
Version: 1.0.3
Overview
The Laravel Repository Package simplifies database interactions by providing a clean, organized approach to managing data in Laravel applications. With repositories, the package decouples data access logic from business logic, making your codebase more maintainable and scalable.
Features
- Entity Repositories: Automatically generate repository classes linked to Laravel models, promoting a more organized codebase.
- CRUD Operations: Consistent interfaces for Create, Read, Update, and Delete operations.
- Custom Query Logic: Easily extend repositories to include custom queries tailored to your application's needs.
- Transaction Management: Handle database transactions through repository methods for cleaner and safer operations.
- Native Queries: Execute raw SQL queries securely with automatic parameter binding.
Installation
-
Install via Composer:
-
(Optional) Publish the configuration:
- Generate repositories:
Usage
Once installed, you can generate repositories using the provided Artisan command. For example, to generate a repository for a User
model:
This will generate App\Http\Repositories\UserRepository.
Adding Custom Logic
For instance, let's add custom logic to filter users by status:
Controller Example
In your controller, you can inject the repository and use it to retrieve users:
Using EntityManager Interface
Alternatively, you can access the repository via EntityManagerInterface:
Available Repository Functions
Here are some of the key functions available within your repositories:
License
All versions of laravel-repository with dependencies
illuminate/support Version ^8.0|^9.0|^10.0|^11.0
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0