PHP code example of stijnhau / push-bundle

1. Go to this page and download the library: Download stijnhau/push-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

stijnhau / push-bundle example snippets


class User implements PushRecipientInterface { /* getId(): ?int */ }

#[ORM\Entity]
class PushSubscription extends AbstractPushSubscription {}

if ($user->wantsPush('race_starting')) {     // the app's own preference
    $pushSender->queue($user, new PushMessage(
        $translator->trans('push.race_starting', locale: $user->getLocale()),
        $race->getName(),
        $urlGenerator->generate('race_show', ['id' => $race->getId()]),
        tag: 'race-'.$race->getId(),
    ));
}