Skip to content

Release v3.0.0

Compare
Choose a tag to compare
@ambroisemaupate ambroisemaupate released this 01 Aug 12:13
· 40 commits to master since this release
cbd69af

Standalone server

Mixedfeed v3 introduces big and useful changes, especially if you don’t want to include Mixedfeed in your existing code stack, because you’re not using PHP. For these use cases, we added a standalone HTTP server with a Serialization process to output JSON responses to your website. This allow you to get mixed social feeds, without the need to setup a PHP server, on a server-less app and non-web apps too.

Mixedfeed standalone server is a Docker image that you can execute in any Docker environment simply using env variables to configure your feed providers.

docker run -p 8080:80 \
    -e MF_FACEBOOK_PAGE_ID="xxx" \
    -e MF_FACEBOOK_ACCESS_TOKEN="xxxx" \
    -e MF_INSTAGRAM_USER_ID="xxx" \
    -e MF_INSTAGRAM_ACCESS_TOKEN="xxxx" \
    -e MF_CACHE_PROVIDER="apcu" \
    -e MF_FEED_LENGTH="30" \
    rezozero/mixedfeed;

A docker-compose sample is also available in our repository.

Standalone server takes benefit from the FeedItem object that makes social feeds agnostic and make it easier to serialize it… again 😁.

{
  "items": [
    {}
  ],
  "meta": {
    "time": 1,
    "count": 10
  }
}

But do not feel afraid, standalone server is optional, and you can still benefits from all new features with the PHP library using Composer.

Async requests

Mixedfeed v3 has been refactored to perform HTTP requests in parallel. All feeds parsing and items canonicalization has been moved to dedicated methods that will be executed once all HTTP requests have performed using Guzzle pool system. Almost all FeedProviders are compatible (no Twitter because it does not use Guzzle) and if you are mixing more than two providers, you will notice a great performance bump.

All you need to do it to switch from MixedFeed::getCanonicalItems to MixedFeed::getAsyncCanonicalItems method:

$feed = new MixedFeed([
    new InstagramFeed(
        'instagram_user_id',
        'instagram_access_token',
        null // you can add a doctrine cache provider
    ),
    // … 
]);
return $feed->getAsyncCanonicalItems(12);

MixedFeed::getItems is still available but it’s deprecated.

Even if Twitter providers are not async (PR are welcome if you want to rewrite them with Guzzle) but you still can use them along with async providers.

References