Skip to content

Latest commit

 

History

History
47 lines (30 loc) · 1.97 KB

README.md

File metadata and controls

47 lines (30 loc) · 1.97 KB

CakePHP-2.x-Twitter-Plugin

This is a plugin for CakePHP to connect your app with the Twitter API using OAuth. With this plugin it's possible to access the main API methods (such as status updates, timelines or user) of the Twitter API in all of your controllers. You even have the opportunity to make custom API-Calls with this plugin.

It has a component and a behavior which are largely similar. (If anyone knows a way to combine the code from both into one reusable area please do tell)

Usage

  • Upload to app/Plugin/Twitter

  • Rename Config/twitter.default.php to Config/twitter.php

  • Update the config file with your twitter app keys

  • Go to YOURSITE/twitter/twitter/connect

  • (as one example) Put some code that will send an update to Twitter in a model (maybe something like...)

      public function afterSave($created) {
      	$oauth_token = [either a session or from where the token is saved in db];
      	$oauth_token_secret = [either a session or from where the token is saved in db];
      	$this->Behaviors->load('Twitter.Twitter', array(
      		'oauthToken' => $oauth_token, 
      		'oauthTokenSecret' => $oauth_token_secret,
      		));
      	$this->updateStatus('Some message you want to tweet');
      }
    

The plugin uses 'http_socket_oauth' (https://github.com/neilcrookes/http_socket_oauth) by Neil Crookes <www.neilcrookes.com> as extension for the CakePHP 'HttpSocket'.

NOTE: This plugin does not support the "Twitter for Websites" Features (https://dev.twitter.com/docs/twitter-for-websites) like follow buttons or direct authentication.

Requirements:

Additional Links From Original Fork:

https://github.com/fnitschmann/CakePHP-Twitter-Plugin/wiki/Installation

https://github.com/fnitschmann/CakePHP-Twitter-Plugin/wiki/Function-Reference

https://wiki.github.com/fnitschmann/CakePHP-Twitter-Plugin

@license MIT License (http://www.opensource.org/licenses/mit-license.php)