caxy/silex-skeleton

A pre-configured skeleton for the Silex microframework

Installs: 38

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 12

Forks: 197

Type:project

1.0.0 2016-04-24 20:59 UTC

This package is auto-updated.

Last update: 2024-12-22 07:33:30 UTC


README

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.

This document contains information on how to start using the Silex Skeleton.

Creating a Silex Application

Silex uses Composer to ease the creation of a new project:

composer create-project caxy/silex-skeleton path/to/install

Composer will create a new Silex project under the path/to/install directory.

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:

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.

To see a real-live Silex page in action, start the PHP built-in web server with command:

cd path/to/install
COMPOSER_PROCESS_TIMEOUT=86400 composer run

Then, browse to http://localhost:8888/.

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.

A great way to start learning Silex is via the Documentation, which will take you through all the features of Silex.

What's inside?

The Silex Skeleton is configured with the following service providers:

  • 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:

Read the Providers documentation for more details about Silex Service Providers.

Enjoy!