PHP code example of ichhabrecht / psr7-middleware-yaml-parser
1. Go to this page and download the library: Download ichhabrecht/psr7-middleware-yaml-parser 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/ */
ichhabrecht / psr7-middleware-yaml-parser example snippets
$app->add(new \IchHabRecht\Psr7MiddlewareYamlParser\YamlParser(__DIR__ . '/settings.yml'));
$app->get('/', function ($request, $response, $args) {
$settings = $request->getAttribute('yaml');
return $response;
});
$app->add(new \IchHabRecht\Psr7MiddlewareYamlParser\YamlParser(__DIR__ . '/settings.yml', 'settings'));
$app->get('/', function ($request, $response, $args) {
$settings = $request->getAttribute('settings');
return $response;
});