Caxy Silex Skeleton
Welcome to Caxy's Silex Skeleton - a fully-functional Silex application that
you can use as the skeleton for your new applications. We use this as a
platform for learning and experimentation., (*1)
This document contains information on how to start using the Silex Skeleton., (*2)
Creating a Silex Application
Silex uses Composer to ease the creation of a new project:, (*3)
composer create-project caxy/silex-skeleton path/to/install
Composer will create a new Silex project under the path/to/install directory., (*4)
If your application will serve static assets using the PHP built-in web server
during development, you should add these lines to the top of web/index_dev.php
:, (*5)
if (php_sapi_name() === 'cli-server' && is_file(__DIR__.preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']))) {
return false;
}
Browsing the Demo Application
Congratulations! You're now ready to use Silex., (*6)
To see a real-live Silex page in action, start the PHP built-in web server with
command:, (*7)
cd path/to/install
COMPOSER_PROCESS_TIMEOUT=86400 composer run
Then, browse to http://localhost:8888/., (*8)
Running tests
cd path/to/install
composer test
Getting started with Silex
This distribution is meant to be the starting point for your Silex applications., (*9)
A great way to start learning Silex is via the Documentation, which will
take you through all the features of Silex., (*10)
What's inside?
The Silex Skeleton is configured with the following service providers:, (*11)
-
ServiceControllerServiceProvider - As your Silex application grows, you
may wish to begin organizing your controllers in a more formal fashion.
Silex can use controller classes out of the box, but with a bit of work,
your controllers can be created as services, giving you the full power of
dependency injection and lazy loading.
-
HttpFragmentServiceProvider - Provides fragment rendering in templates.
-
AssetServiceProvider - Provides versioned URLs of front end assets.
-
TwigServiceProvider - Provides integration with the Twig template engine.
In development mode, these service providers support profiling and debugging:, (*12)
Read the Providers documentation for more details about Silex Service
Providers., (*13)
Enjoy!, (*14)