smskin/clico

cli.co URL缩短服务的PHP接口

0.0.1 2020-10-16 18:32 UTC

This package is auto-updated.

Last update: 2024-09-17 03:53:38 UTC


README

安装

Laravel

  • 使用composer require smskin/clico命令
  • 在config/services.php文件中添加相关行
'clico' => [
    'api_token'=>env('CLICO_API_TOKEN','')
]
  • 在.env文件中添加CLICO_API_TOKEN
CLICO_API_TOKEN=[API TOKEN]
  • 可以使用CliCo外观
try {
    $link = CliCo::singleLink(
	    (new LinkRequest())
            ->setTargetUrl('https://msk.wed-expert.com')
            ->setUtm(
                (new UtmModel())
                    ->setPhone('7911111111111')
                )
            );
} catch (HttpException $exception){
	dd($exception);
} catch (ValidationException $exception){
    dd($exception);
}

任何PHP服务

  • 使用composer require smskin/clico命令
  • 可以将库用作任何类
try {
    $link = (new CliCo(
        '[API TOKEN]'
    ))->singleLink(
        (new LinkRequest())
            ->setTargetUrl('https://msk.wed-expert.com')
            ->setUtm(
                (new UtmModel())
                    ->setPhone('7911111111111')
                )
            );
} catch (HttpException $exception){
    dd($exception);
} catch (ValidationException $exception){
    dd($exception);
}

使用方法

  • singleLink
  • multipleLinks