shegunbabs/laravel-helpers

出色的Laravel辅助工具

v0.1.1 2021-12-06 12:35 UTC

This package is auto-updated.

Last update: 2024-09-06 18:42:27 UTC


README

example workflow

安装

  composer require shegunbabs/laravel-helpers

辅助工具

carbon

new CarbonCarbon::parse() 提供快捷方式

carbon('today'); //2021-11-29 00:00:00
carbon('yesterday'); //2021-11-28 00:00:00

emoji

使用PHP打印表情符号

emoji('CHARACTER_GRINNING_FACE'); //😀

此函数基于 Spatie Emoji 包。有关更多信息,请参阅文档

chain

使普通对象可链式调用。

chain(new SomeClass)
    ->firstMethod()
    ->secondMethod()
    ->thirdMethod(carry);

// Use "carry" constant to pass the return value of a method into the other.

chain(new Str)->lower('John Doe')->camel(carry);
// returns "johnDoe"
// You can grab the result of the chain by trailing a "()" on the end of it.