PHPackages                             codezero/twitter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. codezero/twitter

ActiveLibrary[API Development](/categories/api)

codezero/twitter
================

Simple Twitter API wrapper

1.1.1(10y ago)140.0k2[2 issues](https://github.com/codezero-be/twitter/issues)MITPHPPHP &gt;=5.4.0

Since Aug 29Pushed 10y ago2 watchersCompare

[ Source](https://github.com/codezero-be/twitter)[ Packagist](https://packagist.org/packages/codezero/twitter)[ RSS](/packages/codezero-twitter/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (1)Dependencies (4)Versions (4)Used By (0)

Simple Twitter API Wrapper
==========================

[](#simple-twitter-api-wrapper)

[![Build Status](https://camo.githubusercontent.com/bf09937416c448162ed8844effda9340c33d8c0c8d2d3a31d6349ec659fe241e/68747470733a2f2f7472617669732d63692e6f72672f636f64657a65726f2d62652f747769747465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/codezero-be/twitter) [![Latest Stable Version](https://camo.githubusercontent.com/b9fa6f3715d98043f672f6bec1f2c858cedf961a9b224c47f77f31bdd8cb26d4/68747470733a2f2f706f7365722e707567782e6f72672f636f64657a65726f2f747769747465722f762f737461626c652e737667)](https://packagist.org/packages/codezero/twitter) [![Total Downloads](https://camo.githubusercontent.com/ca3d4748749248781e42eff21146a8871dfd3ffb0857c5dda0f1889f7a92e8c1/68747470733a2f2f706f7365722e707567782e6f72672f636f64657a65726f2f747769747465722f646f776e6c6f6164732e737667)](https://packagist.org/packages/codezero/twitter) [![License](https://camo.githubusercontent.com/ad16242f08757a35b6c03f158b7ba9a162c6af539e9a69d2129cb1d7167f7472/68747470733a2f2f706f7365722e707567782e6f72672f636f64657a65726f2f747769747465722f6c6963656e73652e737667)](https://packagist.org/packages/codezero/twitter)

This package hides away the complexity of "talking" to the Twitter API, but instead offers a few simple functions to execute some basic queries.

Features
--------

[](#features)

- All queries require an **API key** and **API secret** to generate App Credentials
- Authorization will be triggered automatically behind the scenes
- Fetch a user's tweets with a single method call
- Search Twitter for a hash tag or keyword
- Get the results in standard JSON format, or use our simplified `Tweet` objects
- Optional Caching (only [Laravel](http://www.laravel.com/ "Laravel") implementation included, see [codezero-be/courier](https://github.com/codezero-be/courier))
- Optional [Laravel](http://www.laravel.com/ "Laravel") ServiceProvider included

Installation
------------

[](#installation)

Install this package through Composer:

```
"require": {
    "codezero/twitter": "1.*"
}

```

Setup
-----

[](#setup)

### Laravel Setup

[](#laravel-setup)

After installing, update your Laravel `config/app.php` file to include a reference to this package's service provider in the providers array:

```
'providers' => [
    'CodeZero\Twitter\TwitterServiceProvider'
]

```

Next, publish the package config file and [enter your API credentials](#edit-configuration).

With Laravel 4.\*:

```
php artisan config:publish codezero/twitter

```

With Laravel 5.\*:

```
php artisan vendor:publish --provider="CodeZero\Twitter\TwitterServiceProvider"

```

### Manual Setup

[](#manual-setup)

Specify the location of your config file. An example configuration file is included in the `src/config` folder. You can put this anywhere you want.

```
$config = '/path/to/configFile.php';

```

Create Twitter instance:

```
use CodeZero\Twitter\Twitter;
$twitter = new Twitter($config);

```

Edit Configuration
------------------

[](#edit-configuration)

Your configuration file should look like the following:

```
