johnnylib / aliyunsls-for-laravel
There is no license information available for the latest version (v1.1.0) of this package.
AliyunSLS for laravel
Package info
github.com/johnnylib/aliyunsls-for-laravel
Language:HTML
pkg:composer/johnnylib/aliyunsls-for-laravel
v1.1.0
2021-04-29 08:19 UTC
This package is not auto-updated.
Last update: 2026-04-17 07:41:49 UTC
README
运行环境
-
php
^7.0 -
Laravel
^6.0
安装
- 推荐使用composer安装,执行如下命令
composer require johnnylib/aliyunsls-for-laravel
- 注册Laravel服务, 在config/app.php 添加
'providers' => [ // ... 'Johnnylib\AliyunSls\AliyunSlsServiceProvider::class', ]
添加aliases配置
'aliases' => [ // ... 'Sls' => Johnnylib\AliyunSls\Facades\Sls::class, ]
- 发布资源,在config目录下生成一个aliyunsls.php文件
php artisan vendor:publish --provider="Johnnylib\AliyunSls\AliyunSlsServiceProvider"
添加配置项
在config/aliyunsls.php 中添加配置,您也可以在.env文件中添加对应配置项
return [ 'endpoint' => env('ALIYUN_SLS_ENDPOINT', ''), 'access_key' => env('ALIYUN_SLS_ACCESS_KEY', ''), 'access_secret' => env('ALIYUN_SLS_ACCESS_SECRET', ''), 'project' => env('ALIYUN_SLS_PROJECT', ''), 'default_logstore' => env('','test'), ]
使用举例
Sls Facade类提供了不同种日志级别写入函数:
Sls::info(); Sls::warning(); Sls::error(); Sls::debug();
依赖SDK
Aliyun Log Service PHP SDK,API VERSION 0.6.1
License
The code for Predis is distributed under the terms of the MIT license (see LICENSE).