edamov / pushok

PHP client for Apple Push Notification Service (APNs) - Send push notifications to iOS using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key)
MIT License
368 stars 119 forks source link

Class 'AuthProvider\\Token' not found #132

Closed oktaykalfa closed 1 year ago

oktaykalfa commented 3 years ago

Hello Developer,

// Be aware of thing that Token will stale after one hour, so you should generate it again. // Can be useful when trying to send pushes during long-running tasks $authProvider = \AuthProvider\Token::create($options);

this line is not working even if i added "use Pushok\AuthProvider;"

I see no replacement. What can i do for this? Thanks for your helps.

Best Regards.

stollr commented 3 years ago

If you have installed the library with composer, did you include composer's autoload file?

Like this:

include 'vendor/autoload.php';

If you have added use Pushok\AuthProvider; to your PHP file, then you have to instantiate the token like this:

$authProvider = AuthProvider\Token::create($options); // bo backslash in front of AuthProvider

Otherwise PHP will search for the AuthProvider in the global namespace instead of the Pushok namespace.

yasinahmed81 commented 3 years ago

I had this issue on my AWS instance, please install the extensions, gmp and bcmath, then restart your server.