Code Monkey home page Code Monkey logo

phpsocialmediaposts's Introduction

#PHP Social Media Posts

A collection of PHP classes to get posts from popular social media networks in a standard format.

##Requirements Succesfully tested on PHP 5.4 & 5.5. It should work on 5.3 but it hasn't been tested.

APC is required for caching to work (optional).

##Installation Include SocialMedia.class.php somewhere in your code, then include Facebook.class.php, Twitter.class.php and Instagram.class.php.

##Usage

There are three social media classes that each extend a base SocialMedia class. These are Facebook, Twitter and Instagram.

Each class has the same interface for getting posts: getLatestPosts($start = 0, $count = 1) which returns a collection of arrays.

Each array contains text, url, picture and date properties.

As long as APC is enabled then the responses from the social media channels will be cached. The default cache time is 10 mins.

###Examples:

// Get latest Facebook post
$facebook = new Facebook([app_key], [app_secret], [facebook_id]);
$facebook_posts = $facebook->getLatestPosts();

// Get last two Twitter posts
$twitter = new Twitter([consumer_key], [consumer_secret], [user_token], [user_secret], [screen_name]);
$twitter_posts = $twitter->getLatestPosts(0,2);

// Get the second-to-last Instagram post
$instagram = new Instagram([app_key], [app_secret], [instagram_id]);
$instagram_posts = $instagram->getLatestPosts(1,1);

phpsocialmediaposts's People

Contributors

jamesplayer avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.