PHPackages                             vonbraunlabs/slimx - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. vonbraunlabs/slimx

ActiveLibrary[Framework](/categories/framework)

vonbraunlabs/slimx
==================

1.0.8(5y ago)12.4kPHPPHP &gt;=7.1CI failing

Since May 2Pushed 5y ago5 watchersCompare

[ Source](https://github.com/vonbraunlabs/slimx)[ Packagist](https://packagist.org/packages/vonbraunlabs/slimx)[ RSS](/packages/vonbraunlabs-slimx/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (6)Versions (44)Used By (0)

SlimX - Slim Extended
=====================

[](#slimx---slim-extended)

Provides a thin layer over PHP Slim Microframework, to provide eXtra features.

Status
------

[](#status)

[![Build Status](https://camo.githubusercontent.com/9b87123b253053ed22c84414cd5f59da3701abd9174f7784ee89c3020929ac6d/68747470733a2f2f7472617669732d63692e6f72672f766f6e627261756e6c6162732f736c696d782e706e67)](https://travis-ci.org/vonbraunlabs/slimx)

[![Code Climate](https://camo.githubusercontent.com/039ce1acb9d3f95452b42c31225a54fd911be75517b864a14918b0bbc23b4555/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f766f6e627261756e6c6162732f736c696d782e706e67)](https://codeclimate.com/github/vonbraunlabs/slimx)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/99ebefbdc08f4e79d7b1f1c47f14cc0d2073d0144997cfa923c042f4e14497f3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766f6e627261756e6c6162732f736c696d782f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/vonbraunlabs/slimx/?branch=master)

Install
-------

[](#install)

Install the package using composer:

```
composer require vonbraunlabs/slimx
```

SlimX\\Controllers\\Action
--------------------------

[](#slimxcontrollersaction)

The OO representation of an Action, on the MVC context. Enables HTTP request header routing. While loading the routes, an array of callables can be provided, instead of just the callable. If an array is provided, the keys will be used to determine the `Accept` header:

```
$entrypoints['testGet'] = new Action(
    'GET',
    '/test,
    [
        'application/vnd.vbl.slimx.v1+json' => function ($request, $response, $args) {
            $response->write("{'api-version': 'v1'}");

            return $response;
        },
        'application/vnd.vbl.slimx.v2+json' => function ($request, $response, $args) {
            $response->write("{'api-version': 'v2'}");

            return $response;
        }
    ]
);
```

SlimX\\Controllers\\AbstractController
--------------------------------------

[](#slimxcontrollersabstractcontroller)

Slim controllers may extend the AbstractController, provided by the SlimX. By extending the AbstractController, your controller must extend the loadActions method, that is responsible for loading all Action objects.

Use the `pushEntrypoint` to register the Action objects into Slim. Moreover, the constructior will assign `\Slim\App` and the container to the attributes `app`and `container` respectively.

Here is a example of a controller class using SlimX's AbstractController:

```
