htinlynn/genius-helper

laravel 辅助方法服务

v0.4 2021-05-06 18:21 UTC

This package is auto-updated.

Last update: 2024-09-29 05:08:43 UTC


README

使用 Laravel 进行开发的辅助功能

Latest Version on Packagist Quality Score Software License Total Downloads

关于

  • genius-helper 包是 laravel 开发的辅助库
  • 大部分方法和功能在开发中非常有用

特性

  • 自定义清除所有缓存的命令
  • 日期 API 标准
    • 日期到纪元
    • 纪元到日期
    • 小时到纪元
    • 纪元到小时
    • 日期字符串到带格式的日期
  • 辅助方法
    • 字体检测
    • 是否为缅甸字体?
    • zawGyiToUnicode
    • UnicodeToZawGyi
    • 获取随机数字
    • 根据文件格式字符串获取文件

安装

在您的 composer.json 中要求 htinlynn/genius 包并更新您的依赖项

$ composer require htinlynn/genius-helper

自定义命令的使用方法

  • 清除所有缓存
    • 配置、路由、视图和缓存的全部缓存被清除。
    • 并且配置和缓存被清除

命令(简称)

$ php artisan all:

命令(长称)

$ php artisan all:clearandcache

辅助类使用方法

初始化类

$geniusHelper = new \Genius\Services\GeniusService();

&&

构造函数或特定函数上的依赖注入

protected $geniusInterface;
public function __construct(Genius\Contacts\GeniusInterface $geniusInterface)
{
    $this->geniusInterface = $geniusInterface;
}

可用方法

$geniusHelper->randomDigit($length,$count);
$geniusHelper->formatBytes($size);
$geniusHelper->zawGyiToUnicode($content);
$geniusHelper->unicodeToZawGyi($content);

||

Facades

Genius::randomDigit($length,$count);
Genius::formatBytes($size);
Genius::formatBytes($size);
Genius::formatBytes($size);

特质方法

在使用我的包方法之前需要使用

use GeniusHelper;

可用方法

$this->dateToEpoch($dateString);
$this->hourToEpoch($hourString);
$this->epochToHour($epochString);
$this->epochToDate($epochString);
$this->toDateFormat($dateString);
$this->epochToDateByDateFormat($epochString,$format);

改进

  • 测试案例
  • 贡献指南
  • 版本发布说明

致谢

注意:所有日期时间字符串都使用 UTC 时区,请求参数和响应数据都使用 UTC 时区

许可证

在 MIT 许可证下发布,请参阅 LICENSE