PHP code example of wannanbigpig / supports

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

    

wannanbigpig / supports example snippets


// 测试日志
public function log()
{
    $log = new log([
       'driver' => 'single',
       'level' => 'info',
       'format' => "%datetime% > %channel% [ %level_name% ] > %message% %context% %extra%\r\n\n",
       'path' => '/tmp/wannanbigpig.alipay.log',
    ]);
    $log->info('测试日志');
}

// 测试HttpClient
class foo {
    use HttpRequest;
    
    public function query()
    {
         echo $this->request('POST','http://api.juheapi.com/japi/toh', [
            'key'   => '********',
            'v'     => '1.0',
            'month' => '3',
            'day'   => '28',
        ]);
    }
}

// 测试Config,支持用点获取多维数组,接口 IteratorAggregate, ArrayAccess, Serializable, Countable
public function Config()
{
    $config = new Config([
        'aaa' => 'sfa',
        'bbb' => 'bbb'
    ]);
    $config->set('a.b',['ads','dsds']);
    print_r($config->get('ccc'));
    print_r($config->get());
}