In this post you will learn how to send apple notification or IOS notification using apn voip token in php.
Here below is the working example in how to send IOS notification in php so please follow the one by one example line and make it success in your php application.
Firebase Notification Send PHP Example
Before you start you have to generate p8 file from your server and after generate bundleId from it, follow the below example.
<?php $authKey = 'AuthKey_FILE.p8'; $teamId = </YOUR-TEAM-ID>; $tokenId = </YOUR-TOKEN-ID>; $production = false; // true to production server $notification_payload = []; // your notification data or payload like title body $token_key = file_get_contents($authKey); $jwt_header = [ 'alg' => 'ES256', 'kid' => $tokenId ]; $jwt_payload = [ 'iss' => $teamId, 'iat' => time() ]; $raw_token_data = b64($jwt_header, true).".".b64($jwt_payload, true); $signature = ''; openssl_sign($raw_token_data, $signature, $token_key, 'SHA256'); $jwt = $raw_token_data.".".b64($signature); $request_body = json_encode($notification_payload); $endpoint = $production ? 'https://api.push.apple.com/3/device': 'https://api.development.push.apple.com/3/device'; $url = "$endpoint/$token"; $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_POSTFIELDS => $request_body, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2_0, CURLOPT_HTTPHEADER => [ "content-type: application/json", "authorization: bearer $jwt", "apns-topic: $bundleId" ] ]); $response = curl_exec($ch); $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $err = curl_error($ch); curl_close($ch); echo 'IOS notification send successfully.'
Thank you for read our post.
We always thanks to you for reading our blogs.

Dharmesh Chauhan
(Swapinfoway Founder)Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us

Haresh Chauhan
(Co-Founder)We Are Also Recommending You :
- Slug PHP Function Example - slugify($string)
- PHP Post Request cURL Example With Authentication
- UPI Payment Gateway Integration in PHP/Laravel
- Call to undefined function Gregwar\Captcha\imagecreatetruecolor()
- How to connect database with php
- Error : Trying To Get Property Of ID Non-Object All Possible Solution Guideline In Laravel - PHP
- How To Check Given URL Is Valid Or Not PHP Function Example
- Php Questions for Interview
- Get Zipcode/Pincode From Latitude and Longitude PHP and Google Maps API
- How To Get Youtube Video Thumbnail From URL In PHP - Laravel