承接 ablunier/laravel-database 相关项目开发

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

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

ablunier/laravel-database

最新稳定版本:v1.4.2

Composer 安装命令:

composer require ablunier/laravel-database

包简介

Laravel database utilities package. Repository, cache, abstraction layer.

README 文档

README

This package provides some utilities and patterns to work with Laravel databases

Note: This package is in active development and NOT ready for production.

Features

  • Automatic default and extendable repository pattern.
  • Cache system over repository pattern.
  • Model abstraction layer.

Requirements

  • PHP 5.5 or higher.
  • Laravel 5.

Installation

Require this package with composer:

composer require ablunier/laravel-database

After updating composer, add the ServiceProvider and Facade (optional) to the app.php config file:

// config/app.php

'providers' => [
    '...',
    Ablunier\Laravel\Database\Manager\ModelManagerServiceProvider::class,
];

'aliases' => [
    '...',
    'ModelManager' => Ablunier\Laravel\Database\Manager\Facades\ModelManager::class,
];

Copy the package config to your local config with the publish command:

php artisan vendor:publish

Usage

Repository pattern

<?php
namespace App\Http\Controllers;

use ModelManager;
use View;

class ExampleController extends Controller
{
    public function index()
    {
        $repo = ModelManager::getRepository('App\User');

        $users = $repo->all();

        View::make('users.index', [
            'users' => $users
        ]);
    }
}
<?php
namespace App\Http\Controllers;

use Ablunier\Laravel\Database\Contracts\Manager\ModelManager;
use View;

class ExampleController extends Controller
{
    protected $mm;

    public function __construct(ModelManager $mm)
    {
        $this->mm = $mm;
    }

    public function index()
    {
        $repo = $this->mm->getRepository('App\User');

        $users = $repo->all();

        View::make('users.index', [
            'users' => $users
        ]);
    }
}

Cache

Abstraction layer

Documentation

Visit the wiki for more information.

License

This software is published under the MIT License

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-07-03