khaninejad/linkedin

This package used for send message using laravel notification service

dev-master 2018-04-17 09:32 UTC

This package is not auto-updated.

Last update: 2024-04-17 01:48:50 UTC


README

This package makes it easy to send notifications using Linkedin with Laravel 5.3+.

Contents

Installation

You can install this package via composer:

composer require khaninejad/linkedin@dev-master

Next add the service provider to your config/app.php:

...
'providers' => [
	...
	 khaninejad\linkedin\LinkedinServiceProvider::class,
],
...

Setting up the Linkedin service

You will need to create a Linkedin app in order to use this channel. Within in this app you will find the keys and access tokens. Place them inside your .env file. In order to load them, add this to your config/services.php file:

...
'linkedin' => [
	'client_id'    => env('LINKEDIN_KEY'),
	'client_secret' => env('LINKEDIN_SECRET'),
	'redirect'    => env('LINKEDIN_REDIRECT_URI'),
	'access_token'   => env('LINKEDIN_Access_TOKEN')
]
...

This will load the Linkedin app data from the .env file. Make sure to use the same keys you have used there like LINKEDIN_KEY.

Usage

Follow Laravel's documentation to add the channel to your Notification class.

Publish Linkedin status update

use khaninejad\linkedin\LinkedinChannel;
use khaninejad\linkedin\LinkedinMessage;

class NewsWasPublished extends Notification
{

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

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

Take a closer look at the StatusUpdate object. This is where the magic happens.

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

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please use the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.