1. Go to this page and download the library: Download bibi4k0/apple-pusher 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/ */
bibi4k0 / apple-pusher example snippets
use bIbI4k0\ApplePusher\BaseConfig;
use bIbI4k0\ApplePusher\Curl\CurlWrapper;
use bIbI4k0\ApplePusher\Sender;
use bIbI4k0\ApplePusher\Payload;
$auth = new TokenAuth(
'your apns id',
'your team id',
'content from .p8 cert file or file path with prefix file://'
);
$isSandbox = false;
$sender = new Sender(
$auth,
new CachedCurlWrapper(),
new BaseConfig($isSandbox)
);
$payload = new AlertPayload('Hello dude');
$push = new Push('device token', $payload);
$push->setTopic('bundle id of your app');
$resp = $sender->send($push);
if ($resp->isOk()) {
echo 'push was sent successfully';
}
# for PHP 8.* only
composer composer i4k0/apple-pusher:^1.0
example/cmd.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.