PHP code example of mrgarest / laravel-firebase-sender

1. Go to this page and download the library: Download mrgarest/laravel-firebase-sender 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/ */

    

mrgarest / laravel-firebase-sender example snippets


$firebaseSender = new FirebaseSender('MY_SERVICE_ACCOUNT_NAME');
$firebaseSender->setTopic('MY_TOPIC');
$firebaseSender->setTitle('Hello world');
$firebaseSender->setBody('This is my first message using Laravel Firebase Sender');
$firebaseSender->send();

$firebaseSender = new FirebaseSender('MY_SERVICE_ACCOUNT_NAME');
$firebaseSender->setTopic('MY_TOPIC');
$firebaseSender->setTitleLocKey('hello_world');
$firebaseSender->setBodyLocKey('first_message', ['Laravel Firebase Sender']);
$firebaseSender->send();

$firebaseSender->setDatabaseLog();

$firebaseSender->setDatabaseLog('TEST_VALUE');

$isValue = FirebaseSenderLog::isValue('TEST_VALUE', 'MY_TOPIC');

$isValue = FirebaseSenderLog::isValueByTimeRange(Carbon::now()->subMinutes(30), 'TEST_VALUE', 'MY_TOPIC');

$isValue = FirebaseSenderLog::isToByTimeRange(Carbon::now()->subMinutes(30), 'MY_TOPIC');

php artisan vendor:publish --tag=firebase-sender-config

php artisan vendor:publish --tag=firebase-sender-migrations

php artisan make:migration