Configuration

The Registrar allows to register services defined in config files into the Container.

<?php
$app
->getRegistrar()
    ->
register(getcwd().'/config/services.php')
    ->
register(getcwd().'/config/routes.php');

Config files look like the following:

<?php
return [
    
Gobline\Environment\Environment::class => [
        
'configure' => [
            
'data' => [
                
'defaultLanguage' => 'en',
                
'supportedLanguages' => ['fr''en'],
                
'basePathResolver' => 'auto',
            ],
        ],
    ],
    
Gobline\Translator\Translator::class => [
        
'configure' => [
            
'data' => [
                
'defaultLanguage' => 'en',
                
'translationFiles' => [
                    
// ...
                
],
            ],
        ],
    ],
    
// ...
];

This is how routes are configured through config files:

<?php
return [
    
Gobline\Router\RouteCollection::class => [
        
'configure' => [
            
'configurator' => 
                
Gobline\Router\Provider\Gobline\RouteCollectionConfigurator::class,
            
'data' => [
                
'routes' => [
                    [
                        
'name' => 'logout',
                        
'path' => '/logout',
                        
'allows' => 'GET',
                        
'values' => [
                            
'_action' => App\ActionModel\LogoutActionModel::class,
                            
'_view' => [
                                
'text/html' => getcwd()
                                    .
'/app/View/templates/logout.phtml',
                            ],
                        ],
                    ],
                    [
                        
'name' => 'login',
                        
'path' => '/login',
                        
'allows' => ['GET''POST'],
                        
'values' => [
                            
'_action' => App\ActionModel\LoginActionModel::class,
                            
'_view' => [
                                
'text/html' => getcwd()
                                    .
'/app/View/templates/login.phtml',
                            ],
                        ],
                    ],
                    
// ...
                
],
            ],
        ],
    ],
];