Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Push Bundle Laravel Package

cmnty/push-bundle

View on GitHub
Deep Wiki
Context7

CmntyPushBundle

Latest Version on Packagist Software License Total Downloads

Symfony Bundle for cmnty/push.

Instalation

Require the bundle with composer:

composer require cmnty/push-bundle

Register the bundle in app/AppKernel.php:

public function registerBundles()
{
    $bundles = [
        // ...
        new Cmnty\PushBundle\CmntyPushBundle(),
        // ...
    ];

    return $bundles;
}

Configuration

cmnty_push:
    push_services:
        google:
            enabled: true # Default false, automatically true when api_key is supplied.
            api_key: "%gcm_sender_id%" # Required value.
        mozilla:
            enabled: true # Default true

If you plan on storing the push subscriptions using doctrine, you can use the provided mappings by this bundle.

# Doctrine Configuration
doctrine:
    dbal:
        types:
            binary_string: Cmnty\PushBundle\Doctrine\Type\BinaryStringType
    orm:
        mappings:
            PushSubscription:
                type: xml
                prefix: Cmnty\Push
                dir: "%kernel.root_dir%/../vendor/cmnty/push-bundle/src/Resources/config/embeddable"
                is_bundle: false

Usage

<?php

use Cmnty\Push\Crypto\AuthenticationSecret;
use Cmnty\Push\Crypto\PublicKey;
use Cmnty\Push\EndPoint;
use Cmnty\Push\Notification;
use Cmnty\Push\Subscription;

$notification = new Notification('Hello', 'Symfony!');
$subscription = new Subscription(
    new Endpoint('...'),
    new PublicKey::createFromBase64UrlEncodedString('...'),
    new AuthenticationSecret::createFromBase64UrlEncodedString('...')
);

$client = $this->get('cmnty_push.client');
$client->pushNotification($notification, $subscription);

Credits

License

The MIT License (MIT). Please see License File for more information.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor