henrotaym/laravel-helpers 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

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;

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固