From feb45d2f85d4252361353c80014937d7811bdfd0 Mon Sep 17 00:00:00 2001 From: Dmitry Patsura Date: Thu, 9 Jul 2015 19:22:02 +0900 Subject: [PATCH] Added README --- README.md | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 021a172..6a3df60 100644 --- a/README.md +++ b/README.md @@ -5,5 +5,85 @@ [![Latest Stable Version](https://poser.pugx.org/socialconnect/instagram/v/stable.svg)](https://packagist.org/packages/socialconnect/instagram) [![License](https://poser.pugx.org/SocialConnect/instagram/license.svg)](https://packagist.org/packages/socialconnect/instagram) +Awesome SDK to work with Instagram social network. -![Image](https://ga-beacon.appspot.com/UA-20503308-8/instagram?pixel) +Installation +------------ + +Add a requirement to your `composer.json`: + +```json +{ + "require": { + "socialconnect/instagram": "~0.1" + } +} +``` + +Run the composer installer: + +```bash +php composer.phar install +``` + +How to use +---------- + +First you need to create service: + +```php +// Your Instagram Application's settings +$appId = 'appId'; +$appSecret = 'secret'; + +$instagramClient = new \SocialConnect\Instagram\Client($appId, $appSecret); +$instagramClient->setHttpClient(new \SocialConnect\Common\Http\Client\Curl()); +``` + +## Get user with specified $id: + +```php +$instagramClient = $instagramClient->getUser(715473058); +var_dump($user); +``` + +## Get self information: + +```php +$instagramClient = $instagramClient->getUser(); +var_dump($user); +``` + + +## Customs methods + +```php +$parameters = []; +$result = $instagramClient->request('method/CustomMethod', $parameters); +if ($result) { + var_dump($result); +} +``` + +## Custom entities + +```php +class MyUserEntitiy extends \SocialConnect\Instagram\Entity\User { + public function myOwnMethod() + { + //do something + } +} + +$instagramClient->getEntityUser(new MyUserEntitiy()); +$user = $instagramClient->getUser(1); + +if ($user) { + $instagramClient->myOwnMethod(); +} +``` + +License +------- + +This project is open-sourced software licensed under the MIT License. See the LICENSE file for more information.