SocialShare is a PHP library allowing to retrieve the number of shares of URLs on major social networks. It is also able to generate valid sharing links. It currently supports:
- Google Plus
- Scoop.it!
- StumbleUpon
- Speed: counts are retrieved server-side and cached; no JavaScript SDK loading; no HTTP request from your visitor's browser to social networks
- Privacy: therefore, no data from your visitors is send to social networks, their privacy is respected
- Customization: there is no need to use official social networks buttons, you can create beautiful custom buttons displaying the number of shares
For most social networks, the number of shares is retrieved through services not officially approved by social networks. These services can be shut down without warning.
Service | Official way? |
---|---|
yes | |
no | |
no | |
yes | |
no | |
Scoop.it! | no |
StumbleUpon | no |
Google returns only an estimate when there is more than 1000 shares (something like >10K). PHP Social Share converts this estimate to an integer.
Use Composer to install SocialShare:
composer require dunglas/php-socialshare
SocialShare relies on the Doctrine Cache component to store data retrieved from social networks. Doctrine Cache supports a lot of caching systems including but not limited to file, Memcache, MongoDB and Redis. Use the one that suit your needs.
You can add support for new social networks by creating a class implementing the SocialShare\Provider\ProviderInterface
interface.
Pull Requests are appreciated.
This library has been written by Kévin Dunglas and awesome contributors.