DEV Community

Discussion on: Connect to APNS via HTTP/2 with PHP

Collapse
 
smillerdev profile image
Sean Molenaar

If you're trying to get this to work in 2021:
missing container usage can be replaced by

$config = Configuration::forUnsecuredSigner();
Enter fullscreen mode Exit fullscreen mode

And the builder signature changed to:


$token = (string) $config->builder()
                         ->issuedBy("teamId") // (iss claim) // teamId
                         ->issuedAt(new DateTimeImmutable()) // time the token was issuedAt
                         ->withHeader('kid', "keyId")
                         ->getToken(new Sha256(), new Key\LocalFileReference('file://' . $p8file)); // get the generated token
Enter fullscreen mode Exit fullscreen mode