PHP code example of suntekcorps / hyperf-log-client

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

    

suntekcorps / hyperf-log-client example snippets


return [
    'consumers' => [
        [
            'name' => 'LogServiceProvider',
            'service' => \STK\Client\Log\Base\LogServiceProviderInterface::class,
            'protocol' => 'jsonrpc',
            'registry' => [
                'protocol' => 'consul',
                'address' => env('CONSUL_URI', 'http://190.168.0.201:8500'),
            ],
            'options' => [
                'connect_timeout' => 5.0,
                'recv_timeout' => 5.0,
                'settings' => [
                    'open_eof_split' => true,
                    'package_eof' => "\r\n",
                    'package_max_length' => 1024 * 1024 * 2,
                ],
            ],
        ]
    ],
];

use STK\Client\Log\LogClient;

class TestModel extends LogClient
{
    //表名
    public $table = 'test_table';
    //字段
    public $casts = [
        '_id' => 'object',
        'test_key_1' => 'string',
        'test_key_2' => 'int',
    ];
}