Developed with love by KnpLabs Hire us for your project!
0

GenjSocialFeedBundle

by genj

collecting posts from all type of social feeds like twitter, instagram, facebook for multiple user accounts

GenjSocialFeedBundle

The GenjSocialFeedBundle. Features:

  • Scrape social posts from Twitter, Instagram & Facebook pages.
  • Display most recent posts

Requirements

Installation

Add this bundle and the facebook/instagram/twitter libraries to your composer.json:

    ...
    "require": {
        ...
        "genj/social-feed-bundle": "dev-master"
        ...

Then run composer update. After that is done, enable the bundle in your AppKernel.php:

General

# app/AppKernel.php

class AppKernel extends Kernel
{

    public function registerBundles() {

        $bundles = array(
            ...
            new Genj\SocialFeedBundle\GenjSocialFeedBundle()
            ...

Update your database schema:

php app/console doctrine:schema:update --force

Configuration

Copy the social_feed.yml.dist to app/config/social_feed.yml
Add all the needed configurations.
Remove the providers that you don't need.

Check all Possible configuration by dumping the config

app/console config:dump-reference GenjSocialFeedBundle

Add your basic API tokens to your parameters.yml by adding this to your parameters.yml.dist

genj_social_feed.twitter.consumer_key: null
genj_social_feed.twitter.consumer_secret: null
genj_social_feed.twitter.user_token: null
genj_social_feed.twitter.user_secret: null

genj_social_feed.facebook.app_id: null
genj_social_feed.facebook.app_secret: null
genj_social_feed.facebook.client_token: null

genj_social_feed.instagram.client_id: null

and then run the install command of composer

php composer.phar install

Your config.yml will look like this: (Leave out the providers that you don't use)

genj_social_feed:
    oAuth:
        twitter:
            consumer_key:    %genj_social_feed.twitter.consumer_key%
            consumer_secret: %genj_social_feed.twitter.consumer_secret%
            user_token:      %genj_social_feed.twitter.user_token%
            user_secret:     %genj_social_feed.twitter.user_secret%
        facebook:
            app_id:          %genj_social_feed.facebook.app_id%
            app_secret:      %genj_social_feed.facebook.app_secret%
            client_token:    %genj_social_feed.facebook.client_token%
        instagram:
            client_id:       %genj_social_feed.instagram.client_id%
    feed_users:
        twitter:
            - nicokaag
        facebook:
            - nicokaag
        instagram:
            - nicokaag

Add the needed vich mapping configuration to your config.yml

...
vich_uploader:
    ...
    mappings:
        ...
        genj_socialfeed_post_file:
            uri_prefix:         /uploads/genjsocialfeedpost
            upload_destination: %kernel.root_dir%/../web/uploads/genjsocialfeedpost
            namer:              vich_uploader.namer_origname
            inject_on_load:     true
        genj_socialfeed_post_author_file:
            uri_prefix:         /uploads/genjsocialfeedpostauthor
            upload_destination: %kernel.root_dir%/../web/uploads/genjsocialfeedpostauthor
            namer:              vich_uploader.namer_origname
            inject_on_load:     true

If you want to make use of the JSON api call to get the social posts, add the following routing:

genj_social_feed_posts_get:
    pattern:  /api/social-feed/posts
    defaults:
        _controller: GenjSocialFeedBundle:SocialFeed:getPosts
        _format: ~
        max: 5
        provider: ""
    requirements:
        _method: GET
        max: '^\d+$'

Run feed scraper task

php app/console genj:social-feed --provider=facebook

provider can be:

  • facebook
  • twitter
  • instagram

ToDo

  • Add tests
The MIT License (MIT)

Copyright (c) 2014 G+J Uitgevers CV

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.