update README, source code header
This commit is contained in:
parent
1fc7fd5553
commit
8b0a574051
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
vendor/
|
||||||
|
composer.lock
|
18
README.md
18
README.md
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
# MetaTech\Silex\ControllerServiceProvider
|
# MetaTech Silex ControllerServiceProvider
|
||||||
|
|
||||||
A service provider for [ Silex ](http://silex.sensiolabs.org) for managing DI and mounting on controllers.
|
A service provider for [ Silex ](http://silex.sensiolabs.org) for managing DI and mounting on controllers.
|
||||||
|
|
||||||
|
@ -53,14 +53,14 @@ use Acme\Ctrl\Test;
|
||||||
$app->register(new ControllerServiceProvider(Test::class, [$app], '/test', 'ctrl.'));
|
$app->register(new ControllerServiceProvider(Test::class, [$app], '/test', 'ctrl.'));
|
||||||
|
|
||||||
```
|
```
|
||||||
**first parameter** is your *controller class*
|
*first parameter* is your **controller class**
|
||||||
**second parameter** is an array of your *controller depencies*
|
*second parameter* is an array of your **controller depencies** (default [])
|
||||||
**third parameter** define your controller *routing entry point*
|
*third parameter* define your controller **routing entry point** (default '/')
|
||||||
**fouth parameter** define your *service 's namespace* to acces your controller (default ctrl.)
|
*fouth 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*
|
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.
|
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 :
|
the `connect` method of your controller can now benefits of this service to define appropriate routes, like that :
|
||||||
|
|
||||||
|
@ -82,7 +82,9 @@ class Test implements ControllerProviderInterface
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
see source code of `MetaTech\Core\Ws` for an advance controller architecture.
|
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
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name" : "meta-tech/silex-controller-service",
|
"name" : "meta-tech/silex-controller-service",
|
||||||
"type" : "library",
|
"type" : "library",
|
||||||
"homepage" : "https://github.com/meta-tech/silex-controller-service",
|
"homepage" : "https://github.com/meta-tech/silex-controller-service",
|
||||||
"description" : "Controller service for Silex.",
|
"description" : "Controller service provider for Silex2.",
|
||||||
"license" : "MIT",
|
"license" : "MIT",
|
||||||
"authors" : [
|
"authors" : [
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
|
* This file is part of the silex-controller-service package.
|
||||||
|
*
|
||||||
|
* (c) meta-tech.academy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
namespace MetaTech\Silex\Provider;
|
namespace MetaTech\Silex\Provider;
|
||||||
|
|
||||||
use Pimple\Container;
|
use Pimple\Container;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user