Download the PHP package draliragab/socialize without Composer
On this page you can find all versions of the php package draliragab/socialize. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download draliragab/socialize
More information about draliragab/socialize
Files in draliragab/socialize
Package socialize
Short Description Socialize your Laravel project easily
License MIT
Homepage https://github.com/draliragab/socialize
Informations about the package socialize
Socialize your Laravel project easily
Socialize is a package that helps you to add social media features to your Laravel project easily.
You can share posts to Facebook, Twitter, Instagram and more is coming soon.
Or you can share posts using model trait.
Table of Contents
- Installation
- Configuration
- Usage
- Initialization
- Available Methods to set Options for sharePost() method
- uploadPhoto(), deletePhoto(), uploadVideo(), deleteVideo()
- getPosts()
- getTaggedPosts()
- getPost()
- deletePost()
- getComments()
- getUrl()
- Initialization
- tweet()
- available methods to set options for a tweet
- addComment()
- uploadMedia(), getMediaIds()
- addMedia()
- deleteTweet()
- Initialization
- publishImage()
- publishImageCarousel()
- addComment()
- getUrl()
- getPost()
- Traits
- Socializer
- shareToFacebook(), shareToTwitter(), shareToInstagram()
- Changelog
- Contributing
- Security Vulnerabilities
- Credits
- License
Installation
You can install the package via composer:
You can publish the config file with:
This is the contents of the published config file:
Configuration
For each social media you need to add the required credentials to your .env
file or directly to the published config file.
By default, the package will use the default
configuration. But you can publish to multiple pages and accounts by adding more configurations.
and pass the configuration name to the initialization method.
Usage
All the social media providers have share
and getPostId
methods.
Initialization
Accepts the configuration name as a parameter.
Available Methods to set Options for sharePost() method
Example:
uploadPhoto(), deletePhoto(), uploadVideo(), deleteVideo()
Upload a photo to a Page.
Or you can publish photos directly to a Page.
getPosts()
get the posts of a Facebook Page. Returns Collection
.
Accepts two parameters:
$limit
maximum number of posts to return. Default is 25. Maximum is 100.$fields
fields to return. see https://developers.facebook.com/docs/graph-api/reference/page/feed#readfields
getTaggedPosts()
get all public posts in which the page has been tagged.
getPost()
get a specific post by its id. Returns Collection
.
accepts two parameters:
$postId
the post id$fields
fields to return. see https://developers.facebook.com/docs/graph-api/reference/pagepost#fields
deletePost()
Delete a post by its id. Returns true
if the post is deleted successfully.
getComments()
get comments of a post. Returns Collection
.
accepts three parameters:
$postId
the post id$limit
maximum number of comments to return. Default is 25. Maximum is 100.$fields
fields to return. see https://developers.facebook.com/docs/graph-api/reference/pagepost#fields
getUrl()
get the url of a post.
Initialization
Accepts the configuration name as a parameter.
tweet()
Publish a tweet to a Twitter account.
available methods to set options for a tweet
Example:
addComment()
Add a comment to a tweet.
uploadMedia(), getMediaIds()
Upload media to the account
accepts an array
of media paths.
addMedia()
Add media to a tweet.
accepts an array
of media ids.
You can combine uploadMedia()
and addMedia()
.
deleteTweet()
Delete a tweet by its id. Returns true
if the tweet is deleted successfully.
Initialization
Accepts the configuration name as a parameter.
publishImage()
Publish an image to an Instagram account.
accepts three parameters:
$imageUrl
the image url$caption
the caption of the image$options
an array of options. see https://developers.facebook.com/docs/instagram-api/reference/ig-user/media#query-string-parameters
publishImageCarousel()
Publish an image carousel to an Instagram account.
accepts three parameters:
$imageUrls
an array of image urls$caption
the caption of the image$options
an array of options. see https://developers.facebook.com/docs/instagram-api/reference/ig-user/media#query-string-parameters
addComment()
Add a comment to a post.
getUrl()
get the url of a post.
getPost()
get a specific post by its id. Returns Collection
.
accepts two parameters:
$postId
the post id$fields
fields to return. see https://developers.facebook.com/docs/instagram-api/reference/ig-media#fields
Traits
Socializer
This trait is used to share to social media directly from the model.
shareToFacebook(), shareToTwitter(), shareToInstagram()
Share to social media directly from the model.
All of the above methods search for the image in the image
column of the model and the message in the title
column.
You can change the columns in the config
file.
Or you can pass the message, image and sharing options as array.
Also you can pass the social media account.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Ali Ragab
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of socialize with dependencies
abraham/twitteroauth Version ^6.0
spatie/laravel-package-tools Version ^1.16