1. Go to this page and download the library: Download foziluff/firebase 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/ */
foziluff / firebase example snippets
use Foziluff\Firebase\Facades\FirebasePush;
// Standard notification
FirebasePush::toToken($token)
->withTitle('Hello World')
->withBody('This is a test notification.')
->send();
// With custom data payload, sound, and image
FirebasePush::toToken($token)
->withTitle('Order Shipped')
->withBody('Your order #1234 is on the way!')
->withData(['order_id' => 1234])
->withSound('default')
->withImage('https://example.com/images/promo.jpg')
->send();
use Foziluff\Firebase\Facades\FirebasePush;
FirebasePush::toTopic('news') // or '/topics/news'
->withTitle('Breaking News')
->withBody('Laravel is awesome!')
->withData(['article_id' => 42])
->send();