定制 transprime-research/laravel-chained 二次开发

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

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

transprime-research/laravel-chained

Composer 安装命令:

composer require transprime-research/laravel-chained

包简介

PHP Laravel-Chained

README 文档

README

Build Status Latest Stable Version Total Downloads Latest Unstable Version Latest Monthly Downloads License

About Laravel-chained

Laravel chained help to chain method calls on any class.

Do it Like a PRO 🆗

Installation

  • composer require transprime-research/laravel-chained

Quick Usage

Say we have this class with a lot of static methods. Instead of:

$value = Str::lower('ChainedOnStr');
$value = Str::snake($value);
$value = Str::before($value, '_');
$value = Str::length($value); //7

You use:

$value = chained(Str::class, )
    ->to('lower', 'ChainedOnStr')
    ->to('snake')
    ->to('before', '_')
    ->to('length')(); //14

Or Aliased method calls:

$value = chained(Str::class)
    ->lower('ChainedOnStr')
    ->snake()
    ->before('_')
    ->length()(); //7

Other Usages

tap() method

$value = chained(Str::class)
    ->to('lower', 'ChainedOnStr')
    ->tap(function ($res) {
        var_dump($res);
    })
    ->to('snake')
    ->to('length')
    ->up(); //Up is used instead of ()

Coming Soon

Chain on more classes

use Transprime\Chained\Chained;

$value = chained(DB::class)->to('resolveDb', 'ChainedOnStr')
    ->chain(Str::class, function (Chained $chain) {

        return $chain->to('lower')->to('snake');

    })
    ->chain(Arr::class, function (Chained $chain) {

        return $chain->to('wrap')->to('add', 1, 'using_add');
    })();
    
//Or

chained(DB::class)
    ->to('resolveDb', 'ChainedOnStr')
    ->chain(Str::class) // next calls use `Str` class
    ->to('lower')->to('snake')
    ->chain(Arr::class) // next calls use `Arr` class
    ->to('wrap')->to('add', 1, 'using_add')();

Api implementation to be decided

Additional Information

This package is part of a series of "Code Dare".

See other packages in this series here:

Contributions

For new features, checkout with prefix feature/#issueid e.g feature/#100-add-auto-deploy

  • Clone this repository
  • run sh dockerizer.sh or bash dockerizer.sh
  • execute into the docker environment with docker-compose exec conditional sh (sh can be another bash)
  • run tests with vendor/bin/phpunit

The docker setup was made easy using Laravel Dockerizer

Similar packages

Licence

MIT (See LICENCE file)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固