Getting Started Guide

Twilex provides a simple way for bootstrapping Twitter applications, using Silex, Flint and TTools.

This skeleton project features a functional Twitter authentication (sign-in with Twitter) so you can start developing your application without worrying about the complicated process of tokens exchange and session handling for users authorization. The application follows Symfony conventions.

If you are new to Silex, please have a look at their documentation.

For more info about the TTools library and its features / docs, check its repository: https://github.com/ttools/ttools

1. Creating Twilex skeleton

You’ll need Composer. If you don’t have Composer yet, install it by running:

$ curl -sS https://getcomposer.org/installer | php

Now run the create-project command:

$ php composer.phar create-project twilex/twilex-standard [directory-name] [version]

Where version should be the latest stable release of twilex-standard.

Example:

$ php composer.phar create-project twilex/twilex-standard myTwitterClient 0.1.3

2. Configuring Twilex

Now you need to create a configuration file for Twilex:

$ cd MyTwitterApp
$ cp app/config/config.yml.dist app/config/config.yml

Edit the config.yml file to configure its settings. This is how the default config.yml.dist file looks like:

config:
    name: Twilex
    author: Erika Heidi
    description: Simple Twitter App micro framework
    tags: twitter, silex, micro

twitter.keys:
    api_key: REPLACE_WITH_YOUR_APP_KEY
    api_secret: REPLACE_WITH_YOUR_APP_SECRET

locale: en_GB

bundles.path: "%root_dir%/src"

active_bundles:
    - "%root_dir%/src/ExampleBundle"

http_cache.cache_dir: "%root_dir%/app/cache/http"
routing.resource: "%root_dir%/app/config/routing.yml"

Edit the APP info and provide the Twitter API keys from your Twitter App.

3. Running the Application

Running it locally

If you prefer using a local web server, it’s recommended that you create a vhost using a local domain, such as “myapp.local”. It makes easier for the callback URL configuration. In this scenario, you would use the URL http://myapp.local/connect.