定制 jimchen/laravel-macro 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

jimchen/laravel-macro

Composer 安装命令:

composer require jimchen/laravel-macro

包简介

Laravel Macro Helper

README 文档

README

Build Status

Laravel Macro Helper

Installing

$ composer require jimchen/laravel-macro -vvv

The package will automatically register itself.

If you use Laravel 5.1.*, you can add the service provider to the providers array in config/app.php.

JimChen\Macro\LaravelMacroServiceProvider::class,

Usage

You should publish the config file to add macros.

$ php artisan vendor:publish --provider="JimChen\Macro\LaravelMacroServiceProvider"

Binding macro class to macroable class in config/macro.php.

return [
    'macros' => [
        'Illuminate\Support\Arr' => [
            'App\Macros\Arr',
        ]
    ],
];

Define macro file, app/Macros/Arr1.php.

namespace App\Macro;

class Arr
{
    public static function merge($a, $b)
    {
        return array_merge($a, $b);
    }
}

Using in anywhere if you need. Great!

For example in app/routes/web.php

use Illuminate\Support\Arr;

Route::get('/', function () {
    $foo = [1, 2];
    $bar = [3, 4];
    
    $result = Arr::merge($foo, $bar);
    
    dd($result);  // [1, 2, 3, 4]
});

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固