PHP code example of lswl / laravel-support

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

    

lswl / laravel-support example snippets


// 返回所有表名
DBHelper::getInstance()->getAllTables();

// 返回 mysql 链接下 users 表字段数据
DBHelper::getInstance([
    'name' => 'mysql'
])->getAllColumns('users');

// 默认链接名称(非必填)
$name = 'default';

// 获取默认 redis 链接
RedisConnectionHelper::get($name);
// 获取默认无前缀 redis 链接
RedisConnectionHelper::getNoPrefix($name);
// 获取 phpredis 驱动的链接
RedisConnectionHelper::getPhpRedis($name);
// 获取无前缀 phpredis 驱动的链接
RedisConnectionHelper::getPhpRedisNoPrefix($name);

// 无构造参数使用
T::getInstance()->a();

// 有构造参数使用,c为构造参数名称
T::getInstance([
    'c' => ['a']
])->a();

// 使用 Trait 会将 App/User 转换成 App\User
 php artisan test --class="App/User"