0x17 / laravel-repository
This is a package that help to implement repository pattern in laravel
1.0
2023-08-13 12:46 UTC
This package is auto-updated.
Last update: 2024-10-13 15:34:15 UTC
README
This is a package that help to implement repository pattern in laravel
Installation
The first step is using composer to install the package and automatically update your composer.json file, you can do this by running:
composer require 0x17/laravel-repository
Usage/Examples
create dto
php artisan make:dto User
create service class
php artisan make:service User
create repository class
php artisan make:repository User
Register UserRepository:
<?php namespace App\Providers; use Illuminate\Support\ServiceProvider; use App\Repositories\Interfaces\IUserRepository; use App\Repositories\UserRepository; use App\Models\User; class AppServiceProvider extends ServiceProvider { /** * Register any application services. */ public function register(): void { $this->app->bind(IUserRepository::class, function () { return new UserRepository(new User()); }); } /** * Bootstrap any application services. */ public function boot(): void { // } }