PHP code example of jmhc / laravel-support

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

    

jmhc / laravel-support example snippets


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

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

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

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

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

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