PHP code example of parisek / styleguide
1. Go to this page and download the library: Download parisek/styleguide 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/ */
parisek / styleguide example snippets
\Parisek\Styleguide\Styleguide([
'templates_path' => __DIR__ . '/templates',
'static_path' => __DIR__,
'config_yaml' => __DIR__ . '/styleguide.yaml',
'default_locale' => 'cs',
'twig' => $twig, // optional — reuse the project's Twig env
'twig_context' => [ // optional — globals merged into every inner render
'homeUrl' => '/styleguide/',
'templateUrl' => '',
'langcode' => 'cs',
],
]))->run();
Styleguide::fromYaml(__DIR__ . '/styleguide.yaml', [
'twig_context' => ['templateUrl' => rtrim(dirname($_SERVER['SCRIPT_NAME']), '/')],
])->run();
(new Styleguide([
// …
'translations_path' => __DIR__ . '/translations',
]))->run();
nginx
location /styleguide { try_files $uri /index.php?$query_string; }
bash
BASE=https://your-site.test/styleguide
fail=0
for id in $(curl -sf "$BASE/api/components" | jq -r '.[].id'); do
code=$(curl -s -o /dev/null -w '%{http_code}' "$BASE/render/component/$id")
[ "$code" = 200 ] || { echo "$id -> $code"; fail=1; }
done
exit $fail