songshenzong/siren-client

Siren客户端

此软件包的官方仓库似乎已消失,因此该软件包已被冻结。

v1.0.0 2018-04-25 09:00 UTC

This package is auto-updated.

Last update: 2021-12-08 19:12:44 UTC


README

Build Status Total Downloads Latest Stable Version License PHP Version

安装

使用composer安装此包

composer require songshenzong/siren-client

设置

/**
* If Laravel, Just write these fields in the `env` file
*/
SIREN_TOKEN=YourToken
SIREN_PROTOCOL=udp
SIREN_UDP_HOST=127.0.0.1
SIREN_UDP_PORT=55656
SIREN_TCP_HOST=127.0.0.1
SIREN_TCP_PORT=55657
SIREN_HTTP_HOST=127.0.0.1
SIREN_HTTP_PORT=55658
 
  
/**
* If not Laravel, You Need to `setConfig`
* Requests will be discarded by the server when the token is incorrect
*/
Siren::setConfig([
                     'token'    => 'YourToken',
                     'protocol' => 'udp',
                     'servers'  => [
                         'udp'  => [
                             'host' => '127.0.0.1',
                             'port' => '55656'
                         ],
                         'tcp'  => [
                             'host' => '127.0.0.1',
                             'port' => '55657'
                         ],
                         'http' => [
                             'host' => '127.0.0.1',
                             'port' => '55658'
                         ],
                     ]
                 ]);
 
  
 
// If `SERVER` is multiple servers, the system will randomly choose one to reduce the pressure.

Laravel

发布配置文件。如果不这样做,在执行config:cache Artisan命令时,它们可能无法正确序列化。

php artisan vendor:publish --provider="Songshenzong\Siren\ServiceProvider"

报告

 
/**
* Module and submodule consumption time
*/
Siren::tick('moduleName', 'submoduleName');
 
  
   
/**
* Send success or failure
*/
if (YourClass::action()) {
  Siren::success('moduleName', 'submoduleName');
} else {
  Siren::error('moduleName', 'submoduleName', 'Something wrong');
}
 
 
 
/**
* Handle Exception
*/
try {
  throw new Exception('Message');
} catch (Exception $exception) {
  Siren::exception($exception);
}
 

文档

请参阅我们的详细Wiki文档以获取更多信息。

支持

如果您在Wiki中找不到答案,请避免发布问题。您可以在Songshenzong.com上自由寻求支持。

许可证

此软件包遵循BSD 3-Clause许可证