PHPackages                             linpar/socialshare - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. linpar/socialshare

ActiveLibrary[API Development](/categories/api)

linpar/socialshare
==================

Client library for the Social Share API

1.0.1(11y ago)131MITPHPPHP &gt;=5.3.0

Since Nov 20Pushed 11y agoCompare

[ Source](https://github.com/linpar/Socialshare-Client-PHP)[ Packagist](https://packagist.org/packages/linpar/socialshare)[ Docs](https://github.com/linpar/Socialshare-Client-Php)[ RSS](/packages/linpar-socialshare/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)DependenciesVersions (3)Used By (0)

SocialShare API PHP Client
==========================

[](#socialshare-api-php-client)

[![Latest Stable Version](https://camo.githubusercontent.com/399a98d5eac06dba8b03ad652eac9b68536c4d6301ecf42df68d5383735acfd6/68747470733a2f2f706f7365722e707567782e6f72672f6c696e7061722f736f6369616c73686172652f762f737461626c652e737667)](https://packagist.org/packages/linpar/socialshare) [![Total Downloads](https://camo.githubusercontent.com/8de14b4d062303d6a5e0fc7506842bf6f6528fd38345ad803e494d3b6057c92c/68747470733a2f2f706f7365722e707567782e6f72672f6c696e7061722f736f6369616c73686172652f646f776e6c6f6164732e737667)](https://packagist.org/packages/linpar/socialshare) [![Daily Downloads](https://camo.githubusercontent.com/f5d508b8d4e4d13e35ee704414e3b0ba8b53847118225bea1f55e6bc6013c56c/68747470733a2f2f706f7365722e707567782e6f72672f6c696e7061722f736f6369616c73686172652f642f6461696c792e706e67)](https://packagist.org/packages/linpar/socialshare) [![Latest Unstable Version](https://camo.githubusercontent.com/f9837efc7287dfaf504bef819cb77cd4dbd7daef60a043da4b55d500de010e57/68747470733a2f2f706f7365722e707567782e6f72672f6c696e7061722f736f6369616c73686172652f762f756e737461626c652e737667)](https://packagist.org/packages/linpar/socialshare) [![License](https://camo.githubusercontent.com/264e00aa6cfe29844c593ba3a74199d8af93b491f2cec51c767937219b991581/68747470733a2f2f706f7365722e707567782e6f72672f6c696e7061722f736f6369616c73686172652f6c6963656e73652e737667)](https://packagist.org/packages/linpar/socialshare)

SocialShare API can be used to fetch number of shares for a single or multiple URLs on social platforms.

Features
========

[](#features)

- Support for Facebook.
- Support for Twitter.
- Fetch data for multiple URLs.
- Fetch total number of shares/comments/clicks/likes of multiple URLs on Facebook.
- Fetch combined total number of shares/comments/clicks/likes of multiple URLs on Facebook.
- Fetch total number of shares of multiple URLs on Twitter.

Easy Installation
=================

[](#easy-installation)

Install with git
----------------

[](#install-with-git)

From the command line switch to the directory where dompdf will reside and run the following commands:

```
git clone https://github.com/linpar/Socialshare-Client-PHP.git
git submodule init
git submodule update
```

Install with composer
---------------------

[](#install-with-composer)

To install with Composer, simply add the requirement to your `composer.json`file:

```
{
  "require" : {
    "linpar/socialshare": "1.*"
  }
}
```

And run Composer to update your dependencies:

```
$ curl -sS http://getcomposer.org/installer | php
$ php composer.phar update
```

Before you can use the Composer installation of SocialShare in your application you must include the Composer autoloader

```
// somewhere early in your project's loading, require the Composer autoloader
// see: http://getcomposer.org/doc/00-intro.md
require 'vendor/autoload.php';
```

Simple example
==============

[](#simple-example)

*Note: To get API key, send an email to *

1. Fetch number of shares/click/comments/likes of a URL on Facebook/Twitter (in case of shares).

```
$socialShare = new SocialShare(API_KEY);
print_r('');
print_r($socialShare->facebook->shares(array('http://github.com'))); // Replace facebook with twitter to calculate shares on Twitter
print_r($socialShare->facebook->clicks(array('http://github.com')));
print_r($socialShare->facebook->comments(array('http://github.com')));
print_r($socialShare->facebook->likes(array('http://github.com')));
```

Output:

```
Array
(
    [link] => http://github.com
    [shares] => 13105
)
Array
(
    [link] => http://github.com
    [clicks] => 1
)
Array
(
    [link] => http://github.com
    [comments] => 3673
)
Array
(
    [link] => http://github.com
    [likes] => 5306
)

```

2. Fetch number of shares/click/comments/likes of multiple URLs on Facebook/Twitter (in case of shares).

```
$socialShare = new SocialShare(API_KEY);
print_r('');
print_r($socialShare->facebook->shares(array('http://github.com', 'http://google.com'))); // Replace facebook with twitter to calculate shares on Twitter
print_r($socialShare->facebook->clicks(array('http://github.com', 'http://google.com')));
print_r($socialShare->facebook->comments(array('http://github.com', 'http://google.com')));
print_r($socialShare->facebook->likes(array('http://github.com', 'http://google.com')));
```

Output:

```
Array
(
    [0] => Array
        (
            [link] => http://github.com
            [shares] => 13105
        )

    [1] => Array
        (
            [link] => http://google.com
            [shares] => 6511640
        )

)
Array
(
    [0] => Array
        (
            [link] => http://github.com
            [clicks] => 1
        )

    [1] => Array
        (
            [link] => http://google.com
            [clicks] => 265614
        )

)
Array
(
    [0] => Array
        (
            [link] => http://github.com
            [comments] => 3673
        )

    [1] => Array
        (
            [link] => http://google.com
            [comments] => 1804201
        )

)
Array
(
    [0] => Array
        (
            [link] => http://github.com
            [likes] => 5306
        )

    [1] => Array
        (
            [link] => http://google.com
            [likes] => 1540062
        )

)

```

3. Fetch combined total number of shares/clicks/comments/likes of multiple URLs on Facebook/Twitter (in case of shares).

```
$socialShare = new SocialShare(API_KEY);
print_r('');
print_r($socialShare->facebook->totalShares(array('http://github.com', 'http://google.com')) ."\n"); // Replace facebook with twitter to calculate shares on Twitter
print_r($socialShare->facebook->totalClicks(array('http://github.com', 'http://google.com')) ."\n");
print_r($socialShare->facebook->totalComments(array('http://github.com', 'http://google.com')) ."\n");
print_r($socialShare->facebook->totalLikes(array('http://github.com', 'http://google.com')) ."\n");
```

Output:

```
6524745
265615
1807874
1545368

```

TODO
====

[](#todo)

- Add support for more platforms (Pinterest etc)

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

4243d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fef2c88e94869fab99efd74ec73dd7a00f587fe3c3b6c027fcac6ff4acba585c?d=identicon)[linpar](/maintainers/linpar)

---

Top Contributors

[![linpar](https://avatars.githubusercontent.com/u/2642959?v=4)](https://github.com/linpar "linpar (31 commits)")

---

Tags

apisocialshare

### Embed Badge

![Health badge](/badges/linpar-socialshare/health.svg)

```
[![Health](https://phpackages.com/badges/linpar-socialshare/health.svg)](https://phpackages.com/packages/linpar-socialshare)
```

###  Alternatives

[pgrimaud/instagram-user-feed

This is a scraper to easily fetch any feed and interact with Instagram (like, follow, etc.) without OAuth for PHP.

942667.7k5](/packages/pgrimaud-instagram-user-feed)[m165437/laravel-blueprint-docs

API Blueprint Renderer for Laravel

22879.8k](/packages/m165437-laravel-blueprint-docs)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
