Yii 1.1: yiinstagram

Bring the Instagram's experience on your Yii powered webapp
6 followers

A simple client that let's you connect and integrate your application with Instagram and make every API call. Your users will be able to connect and login to your site using their Instagram. Built over the very nice (and complete) Instagram PHP Implementation API by Mauricio Cuenca.

Requirements

Yii 1.1 or above

Usage

  • Copy the extension content in your extension/yiinstagram folder
  • Create your Instagram App on http://instagr.am/developer/clients/manage/
  • Add the configuration of your client in the Component section of your config file
'instagram' => array(
   'class' => 'ext.yiinstagram.InstagramEngine',
   'config' => array (
                 'client_id' => 'YOUR_CLIENT_ID',
                 'client_secret'   => 'YOUR_CLIENT_SECRET',
                 'grant_type' => 'authorization_code',
                 'redirect_uri' => 'YOUR_CALLBACK_URL',
                 )
)

start the authentication in your desired controller/action simply doin this:

$instagram = Yii::app()->instagram->getInstagramApp();              
$instagram->openAuthorizationUrl();

then in your callback url verifiy if the user has been redirect with the code parameter set

if (isset($_GET['code'])) {
    $session = Yii::app()->getSession();
    $accessToken = $instagram->getAccessToken();
    $instagram->setAccessToken($accessToken); 
    $instagramUser = $instagram->getCurrentUser();
    ....

enojoy asking Instagram API's whatever you want

Resources

Be the first person to leave a comment

Please to leave your comment.

Create extension