mirror of
https://github.com/symfony/recipes.git
synced 2026-09-15 00:56:24 +03:00
119 lines
5.9 KiB
JSON
119 lines
5.9 KiB
JSON
{
|
|
"manifests": {
|
|
"symfony/console": {
|
|
"manifest": {
|
|
"copy-from-recipe": {
|
|
"bin/": "%BIN_DIR%/",
|
|
"src/": "%SRC_DIR%/"
|
|
}
|
|
},
|
|
"files": {
|
|
"bin/console": {
|
|
"contents": [
|
|
"#!/usr/bin/env php",
|
|
"<?php",
|
|
"",
|
|
"use App\\Kernel;",
|
|
"use Symfony\\Bundle\\FrameworkBundle\\Console\\Application;",
|
|
"use Symfony\\Component\\Console\\Input\\ArgvInput;",
|
|
"use Symfony\\Component\\Debug\\Debug;",
|
|
"",
|
|
"set_time_limit(0);",
|
|
"",
|
|
"require dirname(__DIR__).'/vendor/autoload.php';",
|
|
"",
|
|
"if (!class_exists(Application::class)) {",
|
|
" throw new RuntimeException('You need to add \"symfony/framework-bundle\" as a Composer dependency.');",
|
|
"}",
|
|
"",
|
|
"$input = new ArgvInput();",
|
|
"if (null !== $_ENV['APP_ENV'] = $input->getParameterOption(['--env', '-e'], null, true)) {",
|
|
" putenv('APP_ENV='.$_ENV['APP_ENV']);",
|
|
" // force loading .env files when --env is defined",
|
|
" $_SERVER['APP_ENV'] = null;",
|
|
"}",
|
|
"",
|
|
"if ($input->hasParameterOption('--no-debug', true)) {",
|
|
" putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');",
|
|
"}",
|
|
"",
|
|
"require dirname(__DIR__).'/src/.bootstrap.php';",
|
|
"",
|
|
"if ($_SERVER['APP_DEBUG']) {",
|
|
" umask(0000);",
|
|
"",
|
|
" if (class_exists(Debug::class)) {",
|
|
" Debug::enable();",
|
|
" }",
|
|
"}",
|
|
"",
|
|
"$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);",
|
|
"$application = new Application($kernel);",
|
|
"$application->run($input);",
|
|
""
|
|
],
|
|
"executable": true
|
|
},
|
|
"src/.bootstrap.php": {
|
|
"contents": [
|
|
"<?php",
|
|
"",
|
|
"use Symfony\\Component\\Dotenv\\Dotenv;",
|
|
"",
|
|
"require dirname(__DIR__).'/vendor/autoload.php';",
|
|
"",
|
|
"if (!array_key_exists('APP_ENV', $_SERVER)) {",
|
|
" $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] ?? null;",
|
|
"}",
|
|
"",
|
|
"if ('prod' !== $_SERVER['APP_ENV']) {",
|
|
" if (!class_exists(Dotenv::class)) {",
|
|
" throw new RuntimeException('The \"APP_ENV\" environment variable is not set to \"prod\". Please run \"composer require symfony/dotenv\" to load the \".env\" files configuring the application.');",
|
|
" }",
|
|
"",
|
|
" $path = dirname(__DIR__).'/.env';",
|
|
" $dotenv = new Dotenv();",
|
|
"",
|
|
" if (method_exists($dotenv, 'loadEnv')) {",
|
|
" $dotenv->loadEnv($path);",
|
|
" } else {",
|
|
" // fallback code in case your Dotenv component is not 4.2 or higher (when loadEnv() was added)",
|
|
"",
|
|
" if (file_exists($path) || !file_exists($p = \"$path.dist\")) {",
|
|
" $dotenv->load($path);",
|
|
" } else {",
|
|
" $dotenv->load($p);",
|
|
" }",
|
|
"",
|
|
" if (null === $env = $_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) {",
|
|
" $dotenv->populate(array('APP_ENV' => $env = 'dev'));",
|
|
" }",
|
|
"",
|
|
" if ('test' !== $env && file_exists($p = \"$path.local\")) {",
|
|
" $dotenv->load($p);",
|
|
" $env = $_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env;",
|
|
" }",
|
|
"",
|
|
" if (file_exists($p = \"$path.$env\")) {",
|
|
" $dotenv->load($p);",
|
|
" }",
|
|
"",
|
|
" if (file_exists($p = \"$path.$env.local\")) {",
|
|
" $dotenv->load($p);",
|
|
" }",
|
|
" }",
|
|
"}",
|
|
"",
|
|
"$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $_SERVER['APP_ENV'] ?: $_ENV['APP_ENV'] ?: 'dev';",
|
|
"$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];",
|
|
"$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';",
|
|
""
|
|
],
|
|
"executable": false
|
|
}
|
|
},
|
|
"ref": "fda2bf04e85b083fe236f98cba062106fb0a4e26"
|
|
}
|
|
}
|
|
}
|