From 01f7183a05a5bb1b97b3abde3a4f11affeb99174 Mon Sep 17 00:00:00 2001 From: Jessica Date: Fri, 18 Mar 2016 12:32:36 +0000 Subject: [PATCH] Update readme with Twitter example. --- readme.md | 70 ++++++++----------------------------------------------- 1 file changed, 10 insertions(+), 60 deletions(-) diff --git a/readme.md b/readme.md index c0ca3f2..119e63b 100644 --- a/readme.md +++ b/readme.md @@ -17,72 +17,22 @@ Use composer: `composer require jessicadigital/social-feed` ## Example -### Facebook +### Twitter ```php -$feed = new SocialFeed(); - -// Input api credentials -$feed->facebook->setCredentials([ - 'app_id' => '__', - 'app_secret' => '__' -]); - -// Get all recent posts for user 'codeurs.be' -$data = $feed->facebook->getFeed('codeurs.be'); -foreach ($data as $item) { - // ... -} - -// Get a single facebook post -$item = $feed->facebook->getItem('646338148755451_704084252980840'); - -// Get an id or item from a facebook url -$id = $feed->facebook->getIdFromUrl('https://www.facebook.com/_/photos/_/?type=1&theater'); -$item = $feed->facebook->getItemFromUrl('https://www.facebook.com/_/photos/_/?type=1&theater'); -``` - -### Output - -Output returns the following format (as a php object; printed as json for readability): - -```json -{ - "service": "facebook", - "text": "Example.", - "link": "https://www.facebook.com/____", - "id": "_", - "created": 1428764403, - "user": { - "id": "_", - "image": "https://graph.facebook.com/v2.3/_/picture/", - "name": "_", - "handle": null, - "link": "https://facebook.com/profile.php?id=_" - }, - "media": { - "image": "https://graph.facebook.com/_/picture?type=normal", - "video": null - } -} -``` - -If a video is present, information will be available in media.video: - -```json -{ - "image": null, - "video": { - "service": "youtube", - "id": "_", - "image": "http://img.youtube.com/vi/_/hqdefault.jpg" - } -} +$twitter = new JessicaDigital\SocialFeed\Services\TwitterService(array( + 'access_token' => 'xxx', + 'access_token_secret' => 'xxx', + 'consumer_key' => 'xxx', + 'consumer_secret' => 'xxx' +)); +$feed = $twitter->getFeed('jessica_digital'); ``` ## Credentials The following credentials are needed depending on the medium: - Facebook: app_id, app_secret +- Instagram: client_id, client_secret - Twitter: consumer_key, consumer_secret, access_token, access_token_secret -- Instagram: client_id, client_secret \ No newline at end of file +- Youtube: api_key