PHP code example of andymswick / expo

1. Go to this page and download the library: Download andymswick/expo 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/ */

    

andymswick / expo example snippets


return [

    /*
     * The attribute on the notifiable that will be accessed by default for the `to` method.
     */
    'token' => env('EXPO_PUSH_TOKEN', 'push_token'),

];

// ...
use NotificationChannels\Expo\ExpoChannel;
use NotificationChannels\Expo\ExpoMessage;

class CheckInTime extends Notification
{

	// ...

    public function via($notifiable)
    {
        return [ExpoChannel::class];
    }

    public function toExpo($notifiable)
    {
        return (new ExpoMessage)
            ->title("It's time to check in!")
            ->body('Check in now for us to print your name badge')
            ->setJsonData(['screen' => 'CheckIn']);
    }
}

// ...
use NotificationChannels\Expo\ExpoChannel;
use NotificationChannels\Expo\ExpoMessage;

class CheckInTime extends Notification
{

	// ...

    public function via($notifiable)
    {
        return [ExpoChannel::class];
    }

    public function toExpo($notifiable)
    {
		return (new ExpoMessage)
			->to('ExponentPushToken[**********************]')
            ->title("It's time to check in!")
            ->body('Check in now for us to print your name badge')
            ->setJsonData(['screen' => 'CheckIn']);
    }
}
bash
php artisan vendor:publish --provider="NotificationChannels\Expo\ExpoServiceProvider" --tag="migrations"
bash
php artisan migrate
bash
php artisan vendor:publish --provider="NotificationChannels\Expo\ExpoServiceProvider" --tag="config"