PHPackages                             mathieumaingret/socialstream - 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. mathieumaingret/socialstream

ActiveLibrary[API Development](/categories/api)

mathieumaingret/socialstream
============================

PHP helper to aggregate formatted social media posts from Facebook, Twitter, etc ...

3.2(7y ago)013MITPHP &gt;=7.0

Since Nov 20Compare

[ Source](https://github.com/mathieumaingret/socialstream)[ Packagist](https://packagist.org/packages/mathieumaingret/socialstream)[ Docs](https://github.com/mathieumaingret/socialstream)[ RSS](/packages/mathieumaingret-socialstream/feed)WikiDiscussions Synced 2d ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

SocialStream
============

[](#socialstream)

PHP helper to aggregate formatted social media posts from Facebook, Twitter, etc ...

Getting Started
---------------

[](#getting-started)

### Prerequisites

[](#prerequisites)

All you need is PHP (easy part, let's say &gt;= 5.6) and developer accounts for Facebook and/or Twitter.

**Facebook** (**)

- ACCESS\_API
- ACCESS\_TOKEN

**Twitter** (**)

- CONSUMER\_KEY
- CONSUMER\_SECRET
- ACCESS\_TOKEN
- ACCESS\_TOKEN\_SECRET

### Installing

[](#installing)

First run a composer to get the Twitter API from

```
composer install

```

And then require the composer autoload file in your code :

```
require_once  'socialstream/vendor/autoload.php';

```

End with an example of getting some data out of the system or using it for a little demo

Simple Use
----------

[](#simple-use)

Example to retrieve the last 8 posts from a Twitter account :

```
$posts = array();
$nbPosts = 8;
$accountName = 'accountName';
$cacheDuration = 10; // Cache expires after 10 min

$media = new \SocialStream\Media\Twitter();
if ($media->isAuthorized()) {
    $media->setAccount($accountName);
    $media->setCacheExpiration($cacheDuration);
    $posts = $media->getLastPosts($nbPosts);
}
var_dump($posts);

```

### Methods

[](#methods)

#### isAuthorized()

[](#isauthorized)

Check if your API keys are allowed to reach the API.

#### setAccount(string $accountName)

[](#setaccountstring-accountname)

Set the account name (yours for instance).

#### setCacheExpiration(int $cacheExpiration)

[](#setcacheexpirationint-cacheexpiration)

Set cache duration in *minutes*.

#### getLastPosts(int $nbPosts)

[](#getlastpostsint-nbposts)

Retrieve the $nbPosts last formatted posts to be displayed.

This method returns an array of *Post* objects :

VariableTypeDescriptionnetworkstringId of the social media (ex: "twitter")id \*stringId of the posttype \*stringType of post (ex for Facebook : post, picture, video, ...)date \*stringDate d/Mhour \*stringDate H:iauthor \*objectContains name &amp; url (of profile)picturestringUrl of post picture if existslink \*stringUrl to the detailed postcontentstringTextual contentBuild a SocialWall
------------------

[](#build-a-socialwall)

In order to retrieve posts from more than one social media, you can use the *\\SocialStream\\Wall* class :

```
$nbPosts = 8; // nb posts for each media
$posts = array();
$mediasTypes = array(
    'facebook' => '',
    'twitter' => ''
);
$socialWall = new \SocialStream\Wall($mediasTypes, $nbPosts);

$socialWall->shufflePosts(); // If you want to display your posts randomly

$posts = $socialWall->getPosts();
foreach($posts as $post) {
    echo $post->id;
}

```

Add your own social media
-------------------------

[](#add-your-own-social-media)

Check *src/SocialStream/Media/\_Example.php* to add a social media.

Then rebuild composer autoload :

```
composer dump-autoload

```

Then you can call :

```
$media = new \SocialStream\Media\MyNewSocialMedia();

```

Built With
----------

[](#built-with)

- [Twitter-api-php](http://github.com/j7mbo/twitter-api-php) - The simplest PHP Wrapper for Twitter API v1.1 calls

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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 ~22 days

Total

3

Last Release

2734d ago

### Community

Maintainers

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

---

Tags

phpapiSocial Wall

### Embed Badge

![Health badge](/badges/mathieumaingret-socialstream/health.svg)

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

###  Alternatives

[jstolpe/instagram-graph-api-php-sdk

Instagram Graph API PHP SDK

138106.8k2](/packages/jstolpe-instagram-graph-api-php-sdk)

PHPackages © 2026

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