ethinking / push-api
推送API
v3.1.1
2020-11-17 12:14 UTC
Requires
- php: ^7.0
- symfony/dependency-injection: ^5.0
- symfony/http-client: ^4.3|^5.0
- symfony/http-client-contracts: ^1.1.8|^2
- symfony/http-foundation: ^4.4|^5.0
- symfony/http-kernel: ^5.0
- symfony/mime: ^4.3|^5.0
- symfony/validator: ^3.4.30|^4.3.3|^5.0
This package is auto-updated.
Last update: 2024-09-04 18:26:55 UTC
README
推送API
Push.Delivery服务包装器,使通过多种渠道以高速向众多订阅者发送推送通知成为可能
安装
安装此实用程序的最简单和推荐方法是以composer包的形式安装
composer require ethinking/push-api dev-master
用法
将以下代码添加到您的根目录的routes.yaml中
push_api_service_worker: path: /service-worker.js controller: Ethinking\EthinkingPushApiBundle\Controller\ServiceWorkerController::indexAction push_api_web_push: path: /webpush.js controller: Ethinking\EthinkingPushApiBundle\Controller\WebPushController::indexAction
将以下代码添加到您的services.yaml中
Ethinking\EthinkingPushApiBundle\Service\PushApiService: arguments: - '@Symfony\Contracts\HttpClient\HttpClientInterface' - '@logger' - '@Symfony\Contracts\Cache\CacheInterface'
在您的类中初始化
use Ethinking\EthinkingPushApiBundle\Service\PushApiService; use Ethinking\EthinkingPushApiBundle\Entity\Settings; public function __construct(PushApiService $pushApiService) { settings = new Settings( $this->getSettingsId(), $this->getDomain(), $this->getUsername(), $this->getPassword(), $this->getClientId() ); $pushApiService->setSettings($settings); }
更新资源
yarn encore dev
清除缓存
php bin/console c:c
依赖关系
{ "symfony/dependency-injection": "^5.0", "symfony/http-kernel": "^5.0", "symfony/http-foundation": "^4.4|^5.0", "symfony/http-client": "^4.3|^5.0", "symfony/http-client-contracts": "^1.1.8|^2", "symfony/validator": "^3.4.30|^4.3.3|^5.0", "symfony/mime": "^4.3|^5.0" }