michaelhall / link-sharer
Link sharer helper for sharing links on social networks
Installs: 12 237
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=8.0
- datatypes/datatypes: ^3.0
Requires (Dev)
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-10-23 17:55:52 UTC
README
Link sharer helper for sharing links on social networks.
Requirements
- PHP >= 8.0
Install with composer
$ composer require michaelhall/link-sharer
Basic usage
<?php require __DIR__ . '/vendor/autoload.php'; use DataTypes\Net\Url; use MichaelHall\LinkSharer\LinkSharer; $url = Url::parse('https://example.com/'); // $text and $hashtags parameters are optional. $text = 'My Webpage'; $hashtags = ['my', 'webpage']; $linkSharer = new LinkSharer($url, $text, $hashtags); // Prints https://twitter.com/intent/tweet?url=... echo $linkSharer->getTwitterSharer(); // Prints https://www.facebook.com/sharer/sharer.php?u=... echo $linkSharer->getFacebookSharer(); // And so on... echo $linkSharer->getLinkedInSharer(); echo $linkSharer->getRedditSharer(); echo $linkSharer->getTumblrSharer();
License
MIT