1. Go to this page and download the library: Download nishadil/socialpostman 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/ */
nishadil / socialpostman example snippets
use Nishadil\SocialPostman\SocialPostman;
use Nishadil\SocialPostman\Providers\FacebookProvider;
use Nishadil\SocialPostman\Providers\InstagramProvider;
use Nishadil\SocialPostman\Providers\LinkedInProvider;
use Nishadil\SocialPostman\Providers\TwitterProvider;
public function boot(SocialPostman $postman): void
{
$postman->registerProvider(
'facebook',
new FacebookProvider(config('socialpostman.providers.facebook'))
);
$postman->registerProvider(
'instagram',
new InstagramProvider(config('socialpostman.providers.instagram'))
);
$postman->registerProvider(
'linkedin',
new LinkedInProvider(config('socialpostman.providers.linkedin'))
);
$postman->registerProvider(
'twitter',
new TwitterProvider(config('socialpostman.providers.twitter'))
);
}
use Nishadil\SocialPostman\Laravel\Facades\SocialPostman;
SocialPostman::post('twitter', [
'message' => 'Hello X 👋 from Laravel'
]);
use Nishadil\SocialPostman\Laravel\Jobs\PublishSocialPost;
PublishSocialPost::dispatch('facebook', [
'message' => '🚀 Background post from Laravel'
]);
ishadil\SocialPostman\SocialPostman;
use Nishadil\SocialPostman\Providers\FacebookProvider;
use Nishadil\SocialPostman\Providers\InstagramProvider;
use Nishadil\SocialPostman\Providers\LinkedInProvider;
use Nishadil\SocialPostman\Providers\TwitterProvider;
$postman = new SocialPostman();
$postman->registerProvider('facebook', new FacebookProvider([
'access_token' => 'FACEBOOK_ACCESS_TOKEN',
'page_id' => 'FACEBOOK_PAGE_ID'
]));
$postman->registerProvider('instagram', new InstagramProvider([
'access_token' => 'INSTAGRAM_ACCESS_TOKEN',
'instagram_user_id' => 'INSTAGRAM_USER_ID'
]));
$postman->registerProvider('linkedin', new LinkedInProvider([
'access_token' => 'LINKEDIN_ACCESS_TOKEN',
'author' => 'urn:li:person:XXXX'
]));
$postman->registerProvider('twitter', new TwitterProvider([
'bearer_token' => 'TWITTER_BEARER_TOKEN'
]));
return $postman;
$postman = >post('twitter', [
'message' => 'Hello X 👋 from plain PHP'
]);