PHP code example of meta-tech / silex-controller-service
1. Go to this page and download the library: Download meta-tech/silex-controller-service library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
meta-tech / silex-controller-service example snippets
class Test implements ControllerProviderInterface
{
public function __construct(Application $app, string $foo)
{
// do stuff
}
use MetaTech\Silex\Provider\ControllerServiceProvider;
use Acme\Ctrl\Test;
...
$app->register(new ControllerServiceProvider(Test::class, [$app, 'foo'], '/test', 'ctrl.'));
class Test implements ControllerProviderInterface
{
...
public function connect(Application $app)
{
$collection = $app['controllers_factory'];
$_ = 'ctrl.Test';
$collection->match('/' , "$_:index");
$collection->match('/test', "$_:test");
return $collection;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.