Skip to content

Instantly share code, notes, and snippets.

@naeluh
Last active August 29, 2015 14:11
Show Gist options
  • Save naeluh/4aae639bec4ba0279fe0 to your computer and use it in GitHub Desktop.
Save naeluh/4aae639bec4ba0279fe0 to your computer and use it in GitHub Desktop.
<?php
require 'Twitter.php'
$twtr = new Twitter;
$twtr->tweet('Hello World!');
?>
<?php
require 'vendor/autoload.php';
use Codebird\Codebird;
class Twitter
{
protected $consumer_key = <API_KEY>;
protected $consumer_secret = <API_SECRET>;
protected $access_token = <ACCESS_TOKEN>;
protected $access_secret = <ACCESS_SECRET>;
protected $twitter;
public function __construct()
{
// Fetch new Twitter Instance
Codebird::setConsumerKey($this->consumer_key, $this->consumer_secret);
$this->twitter = Codebird::getInstance();
// Set access token
$this->twitter->setToken($this->access_token, $this->access_secret);
}
public function tweet($message)
{
return $this->twitter->statuses_update(['status' => $message]);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment