PHP code example of ahmedash95 / laravel-facebook-poster-notification

1. Go to this page and download the library: Download ahmedash95/laravel-facebook-poster-notification 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/ */

    

ahmedash95 / laravel-facebook-poster-notification example snippets


...
'providers' => [
	...
	 NotificationChannels\FacebookPoster\FacebookPosterServiceProvider::class,
],
...

...
'facebook_poster' => [
	'app_id'    => getenv('FACEBOOK_APP_ID'),
	'app_secret' => getenv('FACEBOOK_APP_SECRET'),
	'access_token'    => getenv('FACEBOOK_ACCESS_TOKEN'),
]
...

use NotificationChannels\FacebookPoster\FacebookPosterChannel;
use NotificationChannels\FacebookPoster\FacebookPosterPost;

class NewsWasPublished extends Notification
{

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return [FacebookPosterChannel::class];
    }

    public function toFacebookPoster($notifiable) {
        return new FacebookPosterPost('Laravel notifications are awesome!');
    }
}

public function toFacebookPoster($notifiable) {
    return new FacebookPosterPost('Laravel notifications are awesome!');
}

public function toFacebookPoster($notifiable) {
    return (new FacebookPosterPost('Laravel notifications are awesom!'))->withLink('https://laravel.com');
}

public function toFacebookPoster($notifiable) {
    return (new FacebookPosterPost('Laravel notifications are awesom!'))->withImage('tayee.png');
}

public function toFacebookPoster($notifiable) {
    return (new FacebookPosterPost('Laravel notifications are awesom!'))
    	->withVideo('bedaer.mp4',[ 'title' => 'My First Video' , 'Description' => 'published by FacebookPoster.' ]);
}