Getting Started Guide¶
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.
$ 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"
3. Running the Application¶
Using Vagrant (recommended)¶
To get started even more quickly, you can use the included Vagrant setup.
Having these dependencies installed, you can just run:
$ vagrant up
note: Windows is not officially supported by Ansible. If you’re using a Windows machine for developing, you’ll need to use a local web server.
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.