suyar / hyperf-umeng
UMeng OpenApi.
v3.1.6
2024-09-22 17:20 UTC
Requires
- php: >=8.1
- guzzlehttp/guzzle: ^7.0
- hyperf/contract: ~3.1.0
- hyperf/support: ~3.1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- hyperf/testing: ~3.1.0
- phpstan/phpstan: ^1.0
- swoole/ide-helper: ^5.0
README
Installation
Requirements:
- php: >=8.1
- ext-swoole: >=5.0 (SWOOLE_HOOK_NATIVE_CURL)
- Composer >= 2.0
composer require suyar/hyperf-umeng
Usage
Publish the files of the clickhouse component:
php bin/hyperf.php vendor:publish suyar/hyperf-umeng
Modify 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(); } }
Methods
$umeng->uApp; // U-App $umeng->appTrack; // AppTrack $umeng->uMini; // U-MiniProgram
Refer:
Via JetBrains
Contact
License
Donate đ”
If you are using this program or like it, you can support me in the following ways:
- StarăForkăWatch đ
- WechatPayăAliPay â€
WechatPay | AliPay |
---|---|