PHP code example of ibnusyuhada / slim-lite-configuration
1. Go to this page and download the library: Download ibnusyuhada/slim-lite-configuration 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/ */
ibnusyuhada / slim-lite-configuration example snippets
// configuration only available in this route
$app->get("/", function($req,$res,$args){
var_dump($this->settings);
})->add($container->get("config"));
$app = new \Slim\App;
$container = $app->getContainer();
$container["config"] = function ($container){
return new IS\Slim\LiteConfiguration\Configuration(__DIR__ . "/../config/config.yaml",$container);
};
// register for all routes
$app->add($container->get("config"));
$app->get("/", function($req,$res,$args){
var_dump($this->settings);
});
$app->get("/blog", function($req,$res,$args){
var_dump($this->settings);
});
$app->run();