Download the PHP package fengsha/utils without Composer
On this page you can find all versions of the php package fengsha/utils. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fengsha/utils
More information about fengsha/utils
Files in fengsha/utils
Informations about the package utils
PHP工具包
支持 Laravel 5.1 以上,工具包目前有 Log功能。
- Log 对 laravel 的日志功能进行了扩展,增加了
Request Log与Exception Log功能
日志使用开始
Laravel 5.x:
-
编辑项目中 composer.json 文件,增加 repostories 项
-
执行
composer require fengsha/utils:dev-master安装包 -
增加
ServiceProvide,编辑config/app.php -
增加
aliases,编辑config/app.php -
增加
app_name和app_from,编辑config/app.php -
如果要替换框架原有的
Log,需要编辑config/app.php,注释掉原有的Logalias,并将工具命名为Log - 发布配置
Usage
Log
普通日志方法
- emergency
- alert
- critical
- error
- warning
- notice
- info
- debug
Example:
特殊日志方法
- log
- write
Example:
基础日志变更保存路径
type 默认读取 base 配置,文件名默认为 custom.channel 名称
使用时加上自定义路径,路径定以后可以省略路径参数,路径参数请使用绝对路径
路径定以后想再次变更路径
SmokeTest
ExtensionTrait
引用
Example:
checkExtension 检测扩展
配置信息是以 key => value 的方式传递。如果key存在,则会检测该扩展是否已经被加载上。如果value存在,则会检测该扩展的版本(对版本的检测暂时只支持主版本号和次版本号的检测)。如果不想检测扩展的版本号,则可以把value设为"*",这样就可以跳过版本的检测。同时支持对php版本的检测(同样只支持主版本号和次版本号)
checkExtension方法通过$this调用
Example:
checkExtensionVersion 测试扩展的版本号
Example:
日志使用结束
分布式redis锁开始
如果项目没有引入过这个工具,可以在composer.json中引入,增加 repostories 项
-
执行
composer require fengsha/utils:dev-master安装包 -
增加 ServiceProvide,编辑 config/app.php
- 增加 aliases,编辑 config/app.php
分布式redis锁结束
All versions of utils with dependencies
illuminate/contracts Version 8.*
illuminate/support Version 8.*
fluent/logger Version ^1.0