@@ -0,0 +1,10 @@ | |||
# This file is a "template" of which env vars need to be defined for your application | |||
# Copy this file to .env file for development, create environment variables when deploying to production | |||
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration | |||
###> symfony/framework-bundle ### | |||
APP_ENV=dev | |||
APP_SECRET=c78ebf740b9db52319c2c0a201923d62 | |||
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2 | |||
#TRUSTED_HOSTS=localhost,example.com | |||
###< symfony/framework-bundle ### |
@@ -0,0 +1,7 @@ | |||
###> symfony/framework-bundle ### | |||
/.env | |||
/public/bundles/ | |||
/var/ | |||
/vendor/ | |||
###< symfony/framework-bundle ### |
@@ -0,0 +1,39 @@ | |||
#!/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; | |||
use Symfony\Component\Dotenv\Dotenv; | |||
set_time_limit(0); | |||
require __DIR__.'/../vendor/autoload.php'; | |||
if (!class_exists(Application::class)) { | |||
throw new \RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.'); | |||
} | |||
if (!isset($_SERVER['APP_ENV'])) { | |||
if (!class_exists(Dotenv::class)) { | |||
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.'); | |||
} | |||
(new Dotenv())->load(__DIR__.'/../.env'); | |||
} | |||
$input = new ArgvInput(); | |||
$env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev', true); | |||
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)) && !$input->hasParameterOption('--no-debug', true); | |||
if ($debug) { | |||
umask(0000); | |||
if (class_exists(Debug::class)) { | |||
Debug::enable(); | |||
} | |||
} | |||
$kernel = new Kernel($env, $debug); | |||
$application = new Application($kernel); | |||
$application->run($input); |
@@ -0,0 +1,60 @@ | |||
{ | |||
"type": "project", | |||
"license": "proprietary", | |||
"require": { | |||
"php": "^7.1.3", | |||
"ext-ctype": "*", | |||
"ext-iconv": "*", | |||
"symfony/console": "^4.1", | |||
"symfony/flex": "^1.0", | |||
"symfony/framework-bundle": "^4.1", | |||
"symfony/lts": "^4@dev", | |||
"symfony/yaml": "^4.1" | |||
}, | |||
"require-dev": { | |||
"symfony/dotenv": "^4.1" | |||
}, | |||
"config": { | |||
"preferred-install": { | |||
"*": "dist" | |||
}, | |||
"sort-packages": true | |||
}, | |||
"autoload": { | |||
"psr-4": { | |||
"App\\": "src/" | |||
} | |||
}, | |||
"autoload-dev": { | |||
"psr-4": { | |||
"App\\Tests\\": "tests/" | |||
} | |||
}, | |||
"replace": { | |||
"symfony/polyfill-ctype": "*", | |||
"symfony/polyfill-iconv": "*", | |||
"symfony/polyfill-php71": "*", | |||
"symfony/polyfill-php70": "*", | |||
"symfony/polyfill-php56": "*" | |||
}, | |||
"scripts": { | |||
"auto-scripts": { | |||
"cache:clear": "symfony-cmd", | |||
"assets:install %PUBLIC_DIR%": "symfony-cmd" | |||
}, | |||
"post-install-cmd": [ | |||
"@auto-scripts" | |||
], | |||
"post-update-cmd": [ | |||
"@auto-scripts" | |||
] | |||
}, | |||
"conflict": { | |||
"symfony/symfony": "*" | |||
}, | |||
"extra": { | |||
"symfony": { | |||
"allow-contrib": false | |||
} | |||
} | |||
} |
@@ -0,0 +1,5 @@ | |||
<?php | |||
return [ | |||
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], | |||
]; |
@@ -0,0 +1,3 @@ | |||
framework: | |||
router: | |||
strict_requirements: true |
@@ -0,0 +1,30 @@ | |||
framework: | |||
secret: '%env(APP_SECRET)%' | |||
#default_locale: en | |||
#csrf_protection: true | |||
#http_method_override: true | |||
# Enables session support. Note that the session will ONLY be started if you read or write from it. | |||
# Remove or comment this section to explicitly disable session support. | |||
session: | |||
handler_id: ~ | |||
#esi: true | |||
#fragments: true | |||
php_errors: | |||
log: true | |||
cache: | |||
# Put the unique name of your app here: the prefix seed | |||
# is used to compute stable namespaces for cache keys. | |||
#prefix_seed: your_vendor_name/app_name | |||
# The app cache caches to the filesystem by default. | |||
# Other options include: | |||
# Redis | |||
#app: cache.adapter.redis | |||
#default_redis_provider: redis://localhost | |||
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues) | |||
#app: cache.adapter.apcu |
@@ -0,0 +1,3 @@ | |||
framework: | |||
router: | |||
strict_requirements: ~ |
@@ -0,0 +1,4 @@ | |||
framework: | |||
test: true | |||
session: | |||
storage_id: session.storage.mock_file |
@@ -0,0 +1,3 @@ | |||
#index: | |||
# path: / | |||
# controller: App\Controller\DefaultController::index |
@@ -0,0 +1,30 @@ | |||
# This file is the entry point to configure your own services. | |||
# Files in the packages/ subdirectory configure your dependencies. | |||
# Put parameters here that don't need to change on each machine where the app is deployed | |||
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration | |||
parameters: | |||
services: | |||
# default configuration for services in *this* file | |||
_defaults: | |||
autowire: true # Automatically injects dependencies in your services. | |||
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. | |||
public: false # Allows optimizing the container by removing unused services; this also means | |||
# fetching services directly from the container via $container->get() won't work. | |||
# The best practice is to be explicit about your dependencies anyway. | |||
# makes classes in src/ available to be used as services | |||
# this creates a service per class whose id is the fully-qualified class name | |||
App\: | |||
resource: '../src/*' | |||
exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}' | |||
# controllers are imported separately to make sure services can be injected | |||
# as action arguments even if you don't extend any base controller class | |||
App\Controller\: | |||
resource: '../src/Controller' | |||
tags: ['controller.service_arguments'] | |||
# add more service definitions when explicit configuration is needed | |||
# please note that last definitions always *replace* previous ones |
@@ -0,0 +1,39 @@ | |||
<?php | |||
use App\Kernel; | |||
use Symfony\Component\Debug\Debug; | |||
use Symfony\Component\Dotenv\Dotenv; | |||
use Symfony\Component\HttpFoundation\Request; | |||
require __DIR__.'/../vendor/autoload.php'; | |||
// The check is to ensure we don't use .env in production | |||
if (!isset($_SERVER['APP_ENV'])) { | |||
if (!class_exists(Dotenv::class)) { | |||
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.'); | |||
} | |||
(new Dotenv())->load(__DIR__.'/../.env'); | |||
} | |||
$env = $_SERVER['APP_ENV'] ?? 'dev'; | |||
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)); | |||
if ($debug) { | |||
umask(0000); | |||
Debug::enable(); | |||
} | |||
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) { | |||
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); | |||
} | |||
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) { | |||
Request::setTrustedHosts(explode(',', $trustedHosts)); | |||
} | |||
$kernel = new Kernel($env, $debug); | |||
$request = Request::createFromGlobals(); | |||
$response = $kernel->handle($request); | |||
$response->send(); | |||
$kernel->terminate($request, $response); |
@@ -0,0 +1,61 @@ | |||
<?php | |||
namespace App; | |||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; | |||
use Symfony\Component\Config\Loader\LoaderInterface; | |||
use Symfony\Component\Config\Resource\FileResource; | |||
use Symfony\Component\DependencyInjection\ContainerBuilder; | |||
use Symfony\Component\HttpKernel\Kernel as BaseKernel; | |||
use Symfony\Component\Routing\RouteCollectionBuilder; | |||
class Kernel extends BaseKernel | |||
{ | |||
use MicroKernelTrait; | |||
const CONFIG_EXTS = '.{php,xml,yaml,yml}'; | |||
public function getCacheDir() | |||
{ | |||
return $this->getProjectDir().'/var/cache/'.$this->environment; | |||
} | |||
public function getLogDir() | |||
{ | |||
return $this->getProjectDir().'/var/log'; | |||
} | |||
public function registerBundles() | |||
{ | |||
$contents = require $this->getProjectDir().'/config/bundles.php'; | |||
foreach ($contents as $class => $envs) { | |||
if (isset($envs['all']) || isset($envs[$this->environment])) { | |||
yield new $class(); | |||
} | |||
} | |||
} | |||
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader) | |||
{ | |||
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php')); | |||
// Feel free to remove the "container.autowiring.strict_mode" parameter | |||
// if you are using symfony/dependency-injection 4.0+ as it's the default behavior | |||
$container->setParameter('container.autowiring.strict_mode', true); | |||
$container->setParameter('container.dumper.inline_class_loader', true); | |||
$confDir = $this->getProjectDir().'/config'; | |||
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob'); | |||
$loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob'); | |||
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob'); | |||
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob'); | |||
} | |||
protected function configureRoutes(RouteCollectionBuilder $routes) | |||
{ | |||
$confDir = $this->getProjectDir().'/config'; | |||
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob'); | |||
$routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob'); | |||
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob'); | |||
} | |||
} |
@@ -0,0 +1,89 @@ | |||
{ | |||
"psr/cache": { | |||
"version": "1.0.1" | |||
}, | |||
"psr/container": { | |||
"version": "1.0.0" | |||
}, | |||
"psr/log": { | |||
"version": "1.0.2" | |||
}, | |||
"psr/simple-cache": { | |||
"version": "1.0.1" | |||
}, | |||
"symfony/cache": { | |||
"version": "v4.1.3" | |||
}, | |||
"symfony/config": { | |||
"version": "v4.1.3" | |||
}, | |||
"symfony/console": { | |||
"version": "3.3", | |||
"recipe": { | |||
"repo": "github.com/symfony/recipes", | |||
"branch": "master", | |||
"version": "3.3", | |||
"ref": "e3868d2f4a5104f19f844fe551099a00c6562527" | |||
} | |||
}, | |||
"symfony/debug": { | |||
"version": "v4.1.3" | |||
}, | |||
"symfony/dependency-injection": { | |||
"version": "v4.1.3" | |||
}, | |||
"symfony/dotenv": { | |||
"version": "v4.1.3" | |||
}, | |||
"symfony/event-dispatcher": { | |||
"version": "v4.1.3" | |||
}, | |||
"symfony/filesystem": { | |||
"version": "v4.1.3" | |||
}, | |||
"symfony/finder": { | |||
"version": "v4.1.3" | |||
}, | |||
"symfony/flex": { | |||
"version": "1.0", | |||
"recipe": { | |||
"repo": "github.com/symfony/recipes", | |||
"branch": "master", | |||
"version": "1.0", | |||
"ref": "e921bdbfe20cdefa3b82f379d1cd36df1bc8d115" | |||
} | |||
}, | |||
"symfony/framework-bundle": { | |||
"version": "3.3", | |||
"recipe": { | |||
"repo": "github.com/symfony/recipes", | |||
"branch": "master", | |||
"version": "3.3", | |||
"ref": "87c585d24de9f43bca80ebcfd5cf5cb39445d95f" | |||
} | |||
}, | |||
"symfony/http-foundation": { | |||
"version": "v4.1.3" | |||
}, | |||
"symfony/http-kernel": { | |||
"version": "v4.1.3" | |||
}, | |||
"symfony/lts": { | |||
"version": "4-dev" | |||
}, | |||
"symfony/polyfill-mbstring": { | |||
"version": "v1.9.0" | |||
}, | |||
"symfony/routing": { | |||
"version": "4.0", | |||
"recipe": { | |||
"repo": "github.com/symfony/recipes", | |||
"branch": "master", | |||
"version": "4.0", | |||
"ref": "cda8b550123383d25827705d05a42acf6819fe4e" | |||
} | |||
}, | |||
"symfony/yaml": { | |||
"version": "v4.1.3" | |||
} | |||
} |