PSX uses composer as dependency manager. In order to install PSX composer must be installed on your system. More information how to install composer at

The easiest way to start is to install the PSX sample project through composer:

$ php composer.phar create-project psx/sample .

This sample project contains a sample API and all classes which you need to start with PSX.

In case you cant install composer PSX has also a pre-packaged release which already includes all dependencies which you can download at


The main configuration is defined in the file configuration.php which is a simple php array with key value pairs. You must change the key “psx_url” so that it points to the psx public root. All other entries are optional.


This is the configuration file of PSX. Every parameter can be used inside your
application or in the DI container. Which configuration file gets loaded depends 
on the DI container parameter "config.file". See the container.php if you want 
load a different configuration depending on the environment.

return array(

    // The url to the psx public folder (i.e., 
    // or //
    'psx_url'                 => '',

    // The input path 'index.php/' or '' if you use mod_rewrite
    'psx_dispatch'            => 'index.php/',

    // The default timezone
    'psx_timezone'            => 'UTC',

    // Whether PSX runs in debug mode or not. If not error reporting is set to 0
    // Also several caches are used if the debug mode is false
    'psx_debug'               => true,

    // Database parameters which are used for the doctrine DBAL connection
    'psx_connection'          => [
        'dbname'              => 'psx',
        'user'                => 'root',
        'password'            => '',
        'host'                => 'localhost',
        'driver'              => 'pdo_mysql',

    // Path to the routing file
    'psx_routing'             => __DIR__ . '/routes',

    // Folder locations
    'psx_path_cache'          => __DIR__ . '/cache',
    'psx_path_library'        => __DIR__ . '/src',

    // Supported writers
    'psx_supported_writer'    => [

    // Global middleware which are applied before and after every request. Must
    // bei either a classname, closure or PSX\Dispatch\FilterInterface instance
    //'psx_filter_pre'          => [],
    //'psx_filter_post'         => [],

    // A closure which returns a doctrine cache implementation. If null the
    // filesystem cache is used
    //'psx_cache_factory'       => null,

    // A closure which returns a monolog handler implementation. If null the
    // system handler is used
    //'psx_logger_factory'      => null,

    // Class name of the error controller
    //'psx_error_controller'    => null,

    // If you only want to change the appearance of the error page you can 
    // specify a custom template
    //'psx_error_template'      => null,


If your application needs database access you can enter the credentials in the psx_connection key. The connection service provides a Doctrine DBAL connection which you can use in your application.


In order to make a controller accessible you have to define a route in your routes file. If a request arrives at an endpoint PSX tries to autoload the provided class through composer. Here an example route entry:

GET|POST|PUT|DELETE /foo/bar Acme\Api\News\Endpoint

This would invoke the class Acme\Api\News\Endpoint if you visit the route /foo/bar. All controller classes must extend the class PSX\Framework\Controller\ControllerAbstract


If you dont have a local web server you can use the build in HTTP server of PHP. You can start the server with the following command:

php -S public/index.php

The configuration file should have then the following entries:

'psx_url'                 => '',
'psx_dispatch'            => '',