Implementing Zend Framework 2 twitter service

Zend framework 2

Recently I got task to implement Twitter feed into application built on Zend Framework 2. I found that Zend Framework 2 is having ZendService\Twitter\Twitter library which provides a client for the Twitter API so I wanted to give it advantage over other libraries available on Packagist. Using this service it’s possible to get and update your status, reply to friends, direct message friends, block and ublock users, follow/unfollow people, mark tweets as favorites, and much more. I thought It would be easy and it actually was except one tiny quirk in official documentation of package.

First of all we have to add dependency into composer.json file

"zendframework/zendservice-twitter": "2.1.*",

and update only this package

php composer.phar update zendframework/zendservice-twitter

Our application can now use this package to use Twitter API. You have to get four keys from twitter to use it’s API :

  1. Access token – (array key value – ‘twitter-access-token-here’)
  2. Access token secret – (array key value – ‘twitter-access-secret-here’)
  3. API key – (array key value – ‘twitter-consumer-key-here’)
  4. API secret – (array key value – ‘twitter-consumer-secret-here’)

You will get this key after creating new app on this link. When you finish with this you can use this API in you Zend 2 application.

Read More

Vagrant and local tmp folder write permissions

Vagrant
https://www.drupal.org/project/drush-vagrant

Recently I started using vagrant. That was the best decision I made recently and I can’t imagine to work on some project without it. For all my projects I created vagrant configuration. From the beginning something was strange to me – Vagrant created many temp files and folders inside directory where Vagrantfile was located. I asked all my fellows who have had experience with Vagrant and no one faced the same problem – no additional files – only Vagrantfile. I tried to ignore this problem since I coulnd’t find a solution – even I asked Google 😀 . Then I bumped on problem – on some project I even couldn’t execute command VAGRANT UP. I found what was wrong with my OS (Ubuntu 12.04) because I got clear message from vagrant.

Read More