1. Go to this page and download the library: Download magium/twitter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
magium / twitter example snippets
use Magium\Twitter\Actions\AuthenticateTwitter;
class TwitterTest extends \Magium\AbstractTestCase
{
public function testLogin()
{
// Do something that forwards the browser to the twitter OAuth page.
$action = $this->getAction(AuthenticateTwitter::ACTION);
/* @var $action AuthenticateTwitter */
$action->execute();
}
}
use Magium\Twitter\Identities\Twitter
use Magium\Twitter\Actions\AuthenticateTwitter;
class TwitterTest extends \Magium\AbstractTestCase
{
public function testLogin()
{
$identity = $this->getIdentity(Twitter::IDENTITY);
/* @var $identity Twitter */
$identity->setUsername('username');
$identity->setPassword('password');
// Do something that forwards the browser to the twitter OAuth page.
$action = $this->getAction(AuthenticateTwitter::ACTION);
/* @var $action AuthenticateTwitter */
$action->execute();
}
}
public function testSignInWithTwitter()
{
$action = $this->getAction(SignInWithTwitter::ACTION);
/* @var $action SignInWithTwitter */
$action->execute();
}
public function testAuthenticate()
{
$this->getAction(AuthenticateTwitter::ACTION)->execute();
}
public function testTweet()
{
$text = 'This is text I would like to tweet';
$this->getAction(AuthenticateTwitter::ACTION)->execute();
$this->getAction(Tweet::ACTION)->tweet($text);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.