承接 matthewbdaly/laravel-repositories 相关项目开发

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

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

matthewbdaly/laravel-repositories

最新稳定版本:1.2.1

Composer 安装命令:

composer require matthewbdaly/laravel-repositories

包简介

A base repository class and interface, together with a caching decorator. Extend them for use in your own projects.

README 文档

README

Build Status Coverage Status A base repository class and interface, together with a caching decorator. Extend them for use in your own projects.

The base interface is Matthewbdaly\LaravelRepositories\Repositories\Interfaces\AbstractRepositoryInterface. Your repositories should have interfaces that extend this, to facilitate type-hinting them.

This interface is implemented by both the abstract decorator Matthewbdaly\LaravelRepositories\Repositories\Decorators\BaseDecorator and the abstract repository Matthewbdaly\LaravelRepositories\Repositories\Base. Again, you should extend these classes to create your own repositories and decorators. You can then resolve these interfaces in your own service provider as follows:

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton('App\Repositories\Interfaces\ExampleRepositoryInterface', function () {
            $baseRepo = new \App\Repositories\EloquentExampleRepository(new \App\Example);
            $cachingRepo = new \App\Repositories\Decorators\ExampleDecorator($baseRepo, $this->app['cache.store']);
            return $cachingRepo;
        });
    }
}

Artisan tasks

This package implements the following Artisan tasks to help writing boilerplate:

  • make:repository - Makes a repository for the model passed, ie php artisan make:repository Foo. Pass the --all flag to also create the contract and decorator.
  • make:repository:contract - Makes a contract for the model passed, ie php artisan make:repository:contract Foo
  • make:repository:decorator - Makes a decorator for the model passed, ie php artisan make:repository:decorator Foo

统计信息

  • 总下载量: 1.21k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 0
  • 依赖项目数: 5
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-14