PHP code example of fengsha / utils
1. Go to this page and download the library: Download fengsha/utils library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fengsha / utils example snippets
"repositories": [
{
"type": "git",
"url": "[email protected] :ifengshai/php_utils.git"
}
]
'providers' => [
/**
* Customer Service Providers...
*/
Fengsha\Utils\Log\Providers\LoggerServiceProvider::class,
],
'aliases' => [
/**
* Customer aliases
*/
'FsLog' => Fengsha\Utils\Log\Facades\FsLog::class,
],
'app_name' => 'fengsha', // 链路追踪的时候确定是哪个服务
'app_from' => '88888888', // 链路追踪的时候确定是哪个服务
'aliases' => [
// 'Log' => Illuminate\Support\Facades\Log::class,
/**
* Customer aliases
*/
'Log' => Fengsha\Utils\Log\Facades\FsLog::class,
],
Log::info('this is info');
Log::log('info', 'this is info');
Log::write('error', 'this is error');
"repositories": [
{
"type": "git",
"url": "[email protected] :ifengshai/php_utils.git"
}
]
'providers' => [
/**
* Customer Service Providers...
*/
Fengsha\Utils\RedisDistributedLock\Providers\RedisDistributedLockServiceProvider::class
],
'aliases' => [
/**
* Customer aliases
*/
'Lock' => Fengsha\Utils\RedisDistributedLock\Facades\RedisDistributedLock::class
],
sh
php artisan vendor:publish --provider="Fengsha\Utils\Log\Providers\LoggerServiceProvider"
$map = [
'php'=>'5.6.*',
'redis'=>'2.2.*',
'memcached'=>'*',
];
$result = [];
/**
* 检测扩展
* @param array $map 配置信息
* @param array &$result 检测结果
*/
$this->checkExtension($map,$result);
$extension = 'redis';
$version = '2.2.*';
/**
* 测试扩展的版本号————扩展暂时只比较主版本号和次版本号
* @param string $extension [扩展名]
* @param string $version [版本号 *:可以是任何版本]
* @return int 0:版本匹配,1:安装版本大于需求版本,-1:安装版本小于需求版本
*/
$this->checkExtensionVersion($extension,$version);