ethinking/push-api

v3.1.1 2020-11-17 12:14 UTC

This package is auto-updated.

Last update: 2024-04-04 17:17:53 UTC


README

Push.Delivery service wrapper which makes it possible to send Push Notifications via various channels to many subscribers and in high speed

Installation

The easiest and recommended way to install this utility is as a composer package:

composer require ethinking/push-api dev-master

Usage

Add to your root routes.yaml the next code:

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

Add to your services.yaml the next code:

Ethinking\EthinkingPushApiBundle\Service\PushApiService:
    arguments:
        - '@Symfony\Contracts\HttpClient\HttpClientInterface'
        - '@logger'
        - '@Symfony\Contracts\Cache\CacheInterface'

Initialize in your class:

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);
}

Update assets

yarn encore dev

Clear cache

php bin/console c:c

Dependencies

{
    "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"
}