title: Web Push php libriary : Throws internal error
body: <p>I used the web push library to send push notifications
  <a href="https://github.com/web-push-libs/web-push-php" rel="nofollow noreferrer">https://github.com/web-push-libs/web-push-php</a> </p>
  
  <p>I getting an internal error while trying to sen push notification   </p>
  
  <p>I checked in both PHP version:7.1.22,7.2.9-1<br>
  Apache error log throws : </p>
  
  <blockquote>
    <p>[:error][client ::1:33302] PHP Parse error:  syntax error, unexpected
    '?', expecting variable (T_VARIABLE) in
    /PWA/web-push-php-example/vendor/minishlink/web-push/src/Subscription.php
    on line 41, referer: <a href="http://localhost/PWA/web-push-php-example/src/" rel="nofollow noreferrer">http://localhost/PWA/web-push-php-example/src/</a></p>
  </blockquote>
  
  <p>And i also tried in Ngnix / error log : </p>
  
  <blockquote>
    <p>17:22:36 [error] 20232#20232: *46 FastCGI sent in stderr: "PHP
    message: PHP Notice:  Undefined index: endpoint in
    /var/www/html/PWA/web-push-php-example/vendor/minishlink/web-push/src/Subscription.php
    on line 69 PHP message: PHP Fatal error:  Uncaught TypeError: Argument
    1 passed to Minishlink\WebPush\Subscription::__construct() must be of
    the type string, null given, called in
    /var/www/html/PWA/web-push-php-example/vendor/minishlink/web-push/src/Subscription.php
    on line 72 and defined in
    /var/www/html/PWA/web-push-php-example/vendor/minishlink/web-push/src/Subscription.php:39
    Stack trace:   thrown in
    /var/www/html/PWA/web-push-php-example/vendor/minishlink/web-push/src/Subscription.php
    on line 39" while reading response header from upstream, client:
    127.0.0.1, server: local.pwa.com, request: "POST /PWA/web-push-php-example/src/send_push_notification.php HTTP/2.0",
    upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host:
    "localhost", referrer:
    "<a href="https://localhost/PWA/web-push-php-example/src/" rel="nofollow noreferrer">https://localhost/PWA/web-push-php-example/src/</a>"</p>
  </blockquote>
  
  <p>PHP code :  </p>
  
  <pre><code>&lt;?php
  require __DIR__ . '/../vendor/autoload.php';
  use Minishlink\WebPush\WebPush;
  use Minishlink\WebPush\Subscription;
  
  // here I'll get the subscription endpoint in the POST parameters
  // but in reality, you'll get this information in your database
  // because you already stored it (cf. push_subscription.php)
  $sub =json_decode(file_get_contents('php://input'), true);
  $sub_endpoint =$sub['endpoint'];
  $sub_publicKey =$sub['publicKey'];
  $sub_authToken =$sub['authToken'];
  $sub_contentEncoding =$sub['contentEncoding'];
  $notifications = [
      [
          'subscription' =&gt; Subscription::create([            
              'endPoint' =&gt; $sub_endpoint,
              'publicKey' =&gt; $sub_publicKey,            
              'authToken' =&gt; $sub_authToken,            
              'contentEncoding' =&gt; $sub_contentEncoding, // one of PushManager.supportedContentEncodings
          ]),
          'payload' =&gt; '{msg:"test"}',
      ],
  ];
  
  $auth = array(
      'VAPID' =&gt; array(
          'subject' =&gt; 'mailto:me@website.com', // can be a mailto: or your website address
          'publicKey' =&gt; 'BCmti7ScwxxVAlB7WAyxoOXtV7J8vVCXwEDIFXjKvD-ma-yJx_eHJLdADyyzzTKRGb395bSAtxlh4wuDycO3Ih4', // (recommended) uncompressed public key P-256 encoded in Base64-URL
          'privateKey' =&gt; 'HJ*******************' // (recommended) in fact the secret multiplier of the private key encoded in Base64-URL
          //'pemFile' =&gt; './keys/private_key.pem' // if you have a PEM file and can link to it on your filesystem        
      ),
  );
  $defaultOptions = array(
      'TTL' =&gt; 300, // defaults to 4 weeks
      'urgency' =&gt; 'normal', // protocol defaults to "normal"
      'topic' =&gt; 'push', // not defined by default - collapse_key
  );
  
  $webPush = new WebPush($auth, $defaultOptions);
  
  // send multiple notifications with payload
  
  $webPush-&gt;flush();
  
  // send one notification and flush directly
  $webPush-&gt;sendNotification(
      $notifications[0]['subscription'],
      $notifications[0]['payload'], // optional (defaults null)
      true // optional (defaults false)
  );
  </code></pre>