Download the PHP package drmonkeyninja/social-share-url without Composer
On this page you can find all versions of the php package drmonkeyninja/social-share-url. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download drmonkeyninja/social-share-url
More information about drmonkeyninja/social-share-url
Files in drmonkeyninja/social-share-url
Package social-share-url
Short Description A standalone utility library for generating URLs to share content on numerous social media platforms.
License MIT
Informations about the package social-share-url
SocialShareUrl
A standalone utility library for generating URLs to share content on numerous social media platforms.
Social Share currently supports Bluesky, Delicious, Digg, Evernote, Facebook, Friend Feed, Google Bookmarks, Hacker News, LinkedIn, Newsvine, Pinterest, Pocket, Reddit, Slashdot, simple email, StumbleUpon, Technorati, Tumblr, Twitter/X, VK, WhatsApp and Xing.
Requirements
- Composer
Installation
Install via Composer:-
composer require drmonkeyninja/social-share-url ~1
Usage
To generate a social share URL simply use the getUrl()
method passing it the name of the social network you want to link to and the URL of the page you want to share:-
use \drmonkeyninja\SocialShareUrl\SocialShareUrl;
$SocialShareUrl = new SocialShareUrl();
$url = $SocialShareUrl->getUrl('facebook', 'http://example.com');
You can pass further parameters to be included in the share URL by passing them as an array to the third parameter:-
$url = $SocialShareUrl->getUrl(
'facebook',
'http://example.com'
['text' => 'Hello World']
);
Supported parameters include:-
text
image
A full list of the available social networks can be found in the src/data/stubs.php
file. You can also return a full list of the social networks supported by SocialShareUrl
by using the getServices()
method:-
$services = $SocialShareUrl->getServices();
License
The MIT License.