Package Data | |
---|---|
Maintainer Username: | edujugon |
Maintainer Contact: | edujugon@hotmail.com (Eduardo Marcos) |
Package Create Date: | 2016-07-29 |
Package Last Update: | 2016-08-05 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-19 03:10:51 |
Package Statistics | |
---|---|
Total Downloads: | 5,743 |
Monthly Downloads: | 35 |
Daily Downloads: | 3 |
Total Stars: | 13 |
Total Watchers: | 3 |
Total Forks: | 5 |
Total Open Issues: | 0 |
This is a lightly and easy to use package to post on your favorite social sites.
####Social Sites Available:
type in console:
composer require edujugon/social-auto-post
Or update your composer.json file.
"edujugon/social-auto-post": "1.0.*"
Then
composer install
Register the Social service by adding it to the providers array.
'providers' => array(
...
Edujugon\SocialAutoPost\Providers\SocialAutoPostServiceProvider::class
)
Let's add the Alias facade, add it to the aliases array.
'aliases' => array(
...
'SocialAutoPost' => Edujugon\SocialAutoPost\Facades\SocialAutoPost::class,
)
Publish the package's configuration file to the application's own config directory
php artisan vendor:publish --provider="Edujugon\SocialAutoPost\Providers\SocialAutoPostServiceProvider" --tag="config"
Go to laravel facade sample directly.
The default configuration for all Social sites is located in Config/Config.php
Before using this package you should create your app in your social site and then update the config values like follows:
'twitter' => [
'consumerKey' => 'YOUR_CONSUMER_KEY',
'consumerSecret' => 'YOUR_CONSUMER_SECRET',
'accessToken' => 'YOUR_ACCESS_TOKEN',
'accessTokenSecret' => 'YOUR_ACCESS_TOKEN_SECRET'
]
You can dynamically set those values or add new ones calling the method config like follows:
$social->config(['consumerKey' => 'new_key','accessToken' => 'new_access_token']);
$social = new SocialAutoPost;
By default it will use Twitter as Social Site but you can also pass the name as parameter:
$social = new SocialAutoPost('twitter');
Now you may use any method what you need. Please see the API List.
Or go to Usage samples directly.
site
method sets the social site, which you pass the name through parameter.
Syntax
object site($socialName)
params
method sets the Post parameters, which you pass through parameter as array.
Syntax
object params(array $data)
Check out the Params Available.
post
method sends the post. This method does not return the post response.
if you want to get the post response you can use withFeedback method chained to this method (post)
Syntax
object post()
withFeedback
method provides the post response just after be sent the post.
Syntax
object/array withFeedback()
config
method sets dynamically the social site app configuration, which you pass through parameter as array.
Syntax
object config(array $data)
getSite
If you want to get the current social site in used, this method gets the social site name.
Syntax
string getSite()
getParams
If you want to get the post parameters, this method may help you.
Syntax
array getParams()
getFeedback
If you want to get the very last post feedback, this method may help you.
Syntax
object/null getFeedback()
getConfig
If you want to get the current social configuration, this method may help you.
Syntax
array getConfig()
You can chain the methods.
$social = new SocialAutoPost('twitter');
$social->params(['status' => 'My new post #twitter])
->post()
->withFeedback();
or with media
$social = new SocialAutoPost('twitter');
$social->params(['status' => 'My new post #twitter,
'media' =>'/path/myImage.jpg'
])
->post()
->withFeedback();
NOTICE that Status cannot be over 140 characters for TWITTER.
or do it separately
$social = new SocialAutoPost('twitter');
$social->params(['status' => 'My new post #twitter])
$social->post();
There are 2 way to get the post response:
Chain the method withFeedback()
to the post()
method.
$social = new SocialAutoPost('twitter');
$social->params(['status' => 'My new post #twitter])
->post()
->withFeedback();
You may call the method getFeedback()
whenever you want after sending the post.
$social->getFeedback();
After register the Alias Facade for this Package, you can use it like follows:
SocialAutoPost::site('twitter')
->params(['status' => 'My new post #twitter'])
->post()
->withFeedback();
It will return the post response.