PHP code example of lion9966 / think-utils

1. Go to this page and download the library: Download lion9966/think-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/ */

    

lion9966 / think-utils example snippets


use lion9966\utils\exception\ResPonseCode;
use lion9966\utils\exception\ResPonseJson;

//通过server自动绑定think\exception\Handle,如果没绑定执行如下
//需要在app/provide.php内定义:
//'think\exception\Handle'=>\lion9966\utils\exception\ExceptionHandle::class
//进行自定义错误处理

//use lion9966\utils\exception\ExceptionHandle;

//引用
use lion9966\utils\permission;
//权限验证中间件
use lion9966\utils\middleware;
permission::class;

//jwt权限验证中间件
use lion9966\utils\middleware;
Auth::class;

//引用Token方法
use lion9966\utils\Token;

//引用方法
use lion9966\utils\Password;

//引用方法
use lion9966\utils\Random;

//引用方法
use lion9966\utils\Tree;

//引用方法
use lion9966\utils\data\UserData;
//已在jwt验证后,绑定类
bind('user-data', UserData::class);
//信息初始化
app('user-data')->withId($userId)->withData($user);

php think permission:install