PHP code example of hello-motto / config-service-provider

1. Go to this page and download the library: Download hello-motto/config-service-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/ */

    

hello-motto / config-service-provider example snippets


__DIR__. "/config/config.yml",
__DIR__. "/config/config.json",
__DIR__. "/config/config.php",


return [
    'parameters' => [
        'dbhost' => 'localhost',
        'dbuser' => 'user',
        'dbpass' => 't@rt1fl3tt3',
        'dbport' => '~' // tilde will be replaced by null value
    ],
    'twig' => [
        'twig.form.templates' => [
            'formage.html.twig'
        ]
    ]
];

$app->register(new HelloMotto\Silex\Config\ConfigServiceProvider(), [
    'config.files' => [],
    'config.constants' => [
        '%web.dir%' => __DIR__.'/../web',
        '%need%' => 'tartiflette',
        etc.
    ]
]);

$app->register(new HelloMotto\Silex\Config\ConfigServiceProvider(), [
    'config.files' => [],
    'config.constants' => [],
    'config.closures' => [
        'security' => [
            'security.firewalls' => [
                'main' => [
                    'users' => function() {
                        return new UserProvider();
                    }
                ]
            ]
        ]
    ]
]);
 php
$app->register(new HelloMotto\Silex\Config\ConfigServiceProvider(), [
    'config.files' => [
        PATH_TO_FIRST_FILE,
        PATH_TO_SECOND_FILE,
        PATH_TO_THIRD_FILE,
        etc.
    ]
]);