Requirements:
- php: >=8.1
- ext-swoole: >=5.0 (SWOOLE_HOOK_NATIVE_CURL)
- Composer >= 2.0
composer require suyar/hyperf-umengPublish the files of the clickhouse component:
php bin/hyperf.php vendor:publish suyar/hyperf-umengModify your config file config/autoload/umeng.php:
<?php
declare(strict_types=1);
use function Hyperf\Support\env;
return [
'api_key' => (string) env('UMENG_API_KEY'),
'api_security' => (string) env('UMENG_API_SECURITY'),
// Guzzle max curl handles.
'max_handles' => 10,
// Guzzle default options.
'options' => [
'timeout' => 0,
],
];Using the default ApiKey and ApiSecurity by [Inject]:
namespace App\Controller;
use Hyperf\Di\Annotation\Inject;
use Suyar\UMeng\Client;
class IndexController
{
#[Inject]
protected Client $client;
public function index()
{
return $this->client->uapp->getAppCount();
}
}Or use factory:
namespace App\Controller;
use Hyperf\Di\Annotation\Inject;
use Suyar\UMeng\Client;use Suyar\UMeng\ClientFactory;
class IndexController
{
#[Inject]
protected ClientFactory $clientFactory;
public function index()
{
$client = $this->clientFactory->get('apiKey', 'apiSecret');
return $client->uapp->getAppCount();
}
}$umeng->uApp; // U-App
$umeng->appTrack; // AppTrack
$umeng->uMini; // U-MiniProgramRefer:
If you are using this program or like it, you can support me in the following ways:
- Star、Fork、Watch 🚀
- WechatPay、AliPay ❤
| WechatPay | AliPay |
|---|---|
![]() |
![]() |

