承接 mtkh73/repo-handler 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mtkh73/repo-handler

Composer 安装命令:

composer require mtkh73/repo-handler

包简介

optimize and make rewritable your project with the repository pattern

README 文档

README

Build Status Total Downloads Latest Stable Version License

About RepositoryPattern

The Repository Pattern is one of the most popular patterns to create an enterprise level application. It restricts us to work directly with the data in the application and creates new layers for database operations, business logic, and the application’s UI. using the Repository Pattern has many advantages:

  • Your business logic can be unit tested without data access logic;
  • The database access code can be reused;
  • Your database access code is centrally managed so easy to implement any database access policies, like caching;
  • It’s easy to implement domain logic;
  • Your domain entities or business entities are strongly typed with annotations; and more.

How to work with this package

php artisan make:repository ModelName

After installing this package, a command will be added on your artisan command with make:repository name. with this command you can create a repository class for your model classes.

After running this command if the model exists, a directory called Repository creates in your app directory.to use your repository class you can inject it in any controller that you want. after that you can easily use all of the features in your repository class.

etc

php artisan make:repository Models\User

In this example, you can see a method with setFilters name!

you can apply your any eloquent filters on your query.but where is these filters??

You can create your filters with this command:

php artisan make:filter With'

After creating the filter, the structure of this class like this :

The implementation of your filter must be in the handle method! the args variable includes the value that you set on the setFilters method!

Be careful after creating the filters, you have to set filters on the repository config file.

In the repositories directory, there are 4 things!

  • a BaseRepository class that is the parent of all repositories that you created in your project and includes and contains a number of functions that can be the same in your repository classes.
  • a BaseRepositoryInterface class
  • a RepositoryServiceProvider for binding your repository classes to the interface that previously made.
  • and finally, a directory with your model name that includes a repository class is created and a directory with contracts name.

Be careful If you want using your repository class with their contracts you have to bind them together on the RepositoryServiceProvider class!

License

The RepositoryPattern-handler is open-sourced software licensed under the MIT license.

统计信息

  • 总下载量: 17
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固