PHPackages                             meta-tech/silex-controller-service - 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. meta-tech/silex-controller-service

ActiveLibrary[Framework](/categories/framework)

meta-tech/silex-controller-service
==================================

Controller service provider for Silex2.

1.0.0(9y ago)1761MITPHPPHP ^7.0

Since Mar 15Pushed 9y ago1 watchersCompare

[ Source](https://github.com/meta-tech/silex-controller-service)[ Packagist](https://packagist.org/packages/meta-tech/silex-controller-service)[ Docs](https://github.com/meta-tech/silex-controller-service)[ RSS](/packages/meta-tech-silex-controller-service/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (2)Used By (1)

MetaTech Silex ControllerServiceProvider
========================================

[](#metatech-silex-controllerserviceprovider)

A service provider for [ Silex ](http://silex.sensiolabs.org) for managing DI and mounting on controllers.

### Requirements

[](#requirements)

PHP 7.0

### Install

[](#install)

The package can be installed using [ Composer ](https://getcomposer.org/).

```
composer require meta-tech/silex-controller-service

```

Or add the package to your `composer.json`.

```
"require": {
    "meta-tech/silex-controller-service" : "~1.0"
}

```

Usage
-----

[](#usage)

The provider will create a service relative to a Controller instance builded with its dependencies.
If the controller implements the `Silex\Api\ControllerProviderInterface` the provider will also mount the controller 's routes to the defined routing entry point

Example
-------

[](#example)

Admit you have a controller Test with dependencies on instanciation :

```
class Test implements ControllerProviderInterface
{
    public function __construct(Application $app, string $foo)
    {
        // do stuff
    }
```

You can use the ControllerServiceProvider to create a service to manage your controller class instanciation :

```
use MetaTech\Silex\Provider\ControllerServiceProvider;
use Acme\Ctrl\Test;
...

$app->register(new ControllerServiceProvider(Test::class, [$app, 'foo'], '/test', 'ctrl.'));
```

*first parameter* is your **controller class**
*second parameter* is an array of your **controller dependencies** (default \[\])
*third parameter* define your controller **routing entry point** (default null : disabling mounting controller's routes)
*fourth parameter* define your **service 's namespace** to access your controller (default 'ctrl.')

The name of the registering service is the `given namespace` followed by your `controller class shortname`

With the previous example `$app['ctrl.Test']` is now available and return your controller instance.

the `connect` method of your controller can now benefits of this service to define appropriate routes, like that :

```
class Test implements ControllerProviderInterface
{
    ...

    public function connect(Application $app)
    {
        $collection = $app['controllers_factory'];
        $_          = 'ctrl.Test';

        $collection->match('/'    , "$_:index");
        $collection->match('/test', "$_:test");

        return $collection;
    }
}
```

Controller 's routes are mount on the defined routing entry point (third parameter);

see source code of `MetaTech\Silex\Ws\Controller` in [ meta-tech\\silex-core ](https://github.com/meta-tech/silex-core) for an advance controller architecture.

### License

[](#license)

The project is released under the MIT license, see the LICENSE file.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3394d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/26345971?v=4)[meta-tech.academy](/maintainers/Meta-Tech)[@meta-tech](https://github.com/meta-tech)

---

Top Contributors

[![a-sansara](https://avatars.githubusercontent.com/u/16254357?v=4)](https://github.com/a-sansara "a-sansara (6 commits)")

---

Tags

php7servicesilexserviceprovidercontrollersilex

### Embed Badge

![Health badge](/badges/meta-tech-silex-controller-service/health.svg)

```
[![Health](https://phpackages.com/badges/meta-tech-silex-controller-service/health.svg)](https://phpackages.com/packages/meta-tech-silex-controller-service)
```

###  Alternatives

[ddesrosiers/silex-annotation-provider

A silex service provider that allows the use of annotations in ServiceControllers.

25249.1k3](/packages/ddesrosiers-silex-annotation-provider)[htmlburger/wpemerge

A micro framework which modernizes WordPress as a CMS development by providing tools to implement MVC and more.

456139.8k8](/packages/htmlburger-wpemerge)[moust/silex-cache

Cache service provider for Silex application

33140.2k1](/packages/moust-silex-cache)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
