0x17/laravel-repository
最新稳定版本:1.0
Composer 安装命令:
composer require 0x17/laravel-repository
包简介
This is a package that help to implement repository pattern in laravel
README 文档
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 { // } }
统计信息
- 总下载量: 34
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-06-24