PHP code example of saxulum / saxulum-controller-provider

1. Go to this page and download the library: Download saxulum/saxulum-controller-provider 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/ */

    

saxulum / saxulum-controller-provider example snippets


$app->register(new ServiceControllerServiceProvider());
$app->register(new SaxulumControllerProvider());

public static function addRoutes(Application $app, $serviceId)
{
    $app
        ->get('/container', $serviceId . ':indexAction')
        ->bind('container_index')
    ;
}

$app['controller.map']
    ->addController()
        ->setNamespace('Saxulum\SaxulumControllerProvider\Controller\ContainerExampleController')
        ->setServiceId('saxulum.saxulumcontrollerprovider.controller.containerinjectcontroller')
        ->setInjectContainer(true)
    ->end()
    ->addController()
        ->setNamespace('Saxulum\SaxulumControllerProvider\Controller\ServiceExampleController')
        ->setServiceId('saxulum.saxulumcontrollerprovider.controller.serviceController')
        ->setInjectionKeys(array('test.data'))
        ->addMethod()
            ->setName('setTestData1')
            ->setInjectionKeys(array('test.data'))
        ->end()
        ->addMethod()
            ->setName('setTestData2')
            ->setInjectionKeys(array('test.data'))
        ->end()
    ->end()
;