henrotaym/laravel-helpers
Composer 安装命令:
composer require henrotaym/laravel-helpers
包简介
A kit of laravel helpers.
README 文档
README
A kit of usefull helpers accessible via a facade.
Compatibility
| Laravel | Package |
|---|---|
| 8.x / 9.x | 1.x |
| 12.x | 2.x |
Installation
composer require henrotaym/laravel-helpers
Access the facade
use Henrotaym/LaravelHelpers/Facades/Helpers;
Available methods
Try
/**
* Trying to execute given callback with given args.
*
* @param callable $callback function to try.
* @param mixed $args arguments to give to callback.
* @return array First element is error (if any), second is response(if no error).
*/
public function try(callable $callback, ...$args): array;
Optional
/**
* Trying to access nested property.
*
* @param object $element
* @param string|array $nested_properties Nested properties. Methods should be like ['method_name' => [$arg1, $arg2]] OR method_name() if it doesn't need arguments.
* @return Illuminate\Support\Optional Nullable nested property.
*/
public function optional(object $element, ...$nested_properties): Illuminate\Support\Optional
doIfJobIsInstanceOf
/**
* Executing given callback if serialized job is instance of given element.
*
* @param Job $job
* @param mixed $instance_of Same parameter types as native php instanceof.
* @param callable $callback It receives job instance as first parameter.
* @return mixed Callback returned value or null if any error.
*/
public function doIfJobIsInstanceOf(Job $job, $instance_of, callable $callback);
uuid
/**
* Creating unique uuid.
*
* @param bool $allow_dash Telling if dashes are allowed in created uuid.
* @return string
*/
public function uuid(bool $allow_dash = false): string;
str_contains
/**
* Telling if given string contains given substring.
*
* @param string $haystack The string to search in.
* @param string $needle The string to search for.
* @return bool
*/
public function str_contains(string $haystack, string $needle);
getDirectory
/**
* Getting directory where the file is located.
*
* @param string $class
* @return string|null Null if any error.
*/
public function getDirectory(string $class): ?string;
henrotaym/laravel-helpers 适用场景与选型建议
henrotaym/laravel-helpers 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.4k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 09 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 henrotaym/laravel-helpers 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 henrotaym/laravel-helpers 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 8.4k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-09-28