Franck J 1 year ago
parent
commit
bc05e9b04a
  1. 2
      .env
  2. 2
      .gitignore
  3. 7
      bin/console
  4. 41
      composer.json
  5. 1785
      composer.lock
  6. 10
      config/bootstrap.php
  7. 8
      config/packages/doctrine_migrations.yaml
  8. 1
      config/packages/framework.yaml
  9. 8
      config/packages/prod/deprecations.yaml
  10. 8
      config/packages/prod/monolog.yaml
  11. 4
      config/packages/routing.yaml
  12. 3
      config/packages/security.yaml
  13. 12
      config/services.yaml
  14. 0
      migrations/.gitignore
  15. 0
      migrations/Version20200404184835.php
  16. 7
      phpunit.xml.dist
  17. 2
      public/.htaccess
  18. 9
      public/index.php
  19. 0
      src/Controller/.gitignore
  20. 54
      src/Kernel.php
  21. 2
      src/Repository/FactureRepository.php
  22. 47
      symfony.lock

2
.env

@ -15,7 +15,7 @@
###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=634024f1ef72439e5adbdca9872f901a
APP_SECRET=06f72aa2f514c19322858fca514c9e45
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
#TRUSTED_HOSTS='^(localhost|example\.com)$'
###< symfony/framework-bundle ###

2
.gitignore

@ -41,7 +41,7 @@
/.env.local
/.env.local.php
/.env.*.local
/.env.test
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/

7
bin/console

@ -4,6 +4,7 @@
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
@ -14,8 +15,8 @@ set_time_limit(0);
require dirname(__DIR__).'/vendor/autoload.php';
if (!class_exists(Application::class)) {
throw new LogicException('You need to add "symfony/framework-bundle" as a Composer dependency.');
if (!class_exists(Application::class) || !class_exists(Dotenv::class)) {
throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.');
}
$input = new ArgvInput();
@ -27,7 +28,7 @@ if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}
require dirname(__DIR__).'/config/bootstrap.php';
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
if ($_SERVER['APP_DEBUG']) {
umask(0000);

41
composer.json

@ -10,30 +10,31 @@
"dompdf/dompdf": "^0.8.5",
"sensio/framework-extra-bundle": "^5.1",
"symfony/apache-pack": "^1.0",
"symfony/asset": "5.0.*",
"symfony/console": "5.0.*",
"symfony/dotenv": "5.0.*",
"symfony/expression-language": "5.0.*",
"symfony/asset": "5.1.*",
"symfony/console": "5.1.*",
"symfony/dotenv": "5.1.*",
"symfony/expression-language": "5.1.*",
"symfony/flex": "^1.3.1",
"symfony/form": "5.0.*",
"symfony/framework-bundle": "5.0.*",
"symfony/http-client": "5.0.*",
"symfony/intl": "5.0.*",
"symfony/mailer": "5.0.*",
"symfony/form": "5.1.*",
"symfony/framework-bundle": "5.1.*",
"symfony/http-client": "5.1.*",
"symfony/http-kernel": "5.1.*",
"symfony/intl": "5.1.*",
"symfony/mailer": "5.1.*",
"symfony/monolog-bundle": "^3.1",
"symfony/notifier": "5.0.*",
"symfony/notifier": "5.1.*",
"symfony/orm-pack": "*",
"symfony/process": "5.0.*",
"symfony/security-bundle": "5.0.*",
"symfony/process": "5.1.*",
"symfony/security-bundle": "5.1.*",
"symfony/serializer-pack": "*",
"symfony/string": "5.0.*",
"symfony/translation": "5.0.*",
"symfony/string": "5.1.*",
"symfony/translation": "5.1.*",
"symfony/twig-pack": "*",
"symfony/validator": "5.0.*",
"symfony/var-dumper": "5.0.*",
"symfony/web-link": "5.0.*",
"symfony/validator": "5.1.*",
"symfony/var-dumper": "5.1.*",
"symfony/web-link": "5.1.*",
"symfony/webpack-encore-bundle": "^1.7",
"symfony/yaml": "5.0.*"
"symfony/yaml": "5.1.*"
},
"require-dev": {
"symfony/debug-pack": "*",
@ -83,8 +84,8 @@
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "5.0.*"
"allow-contrib": true,
"require": "5.1.*"
}
}
}

1785
composer.lock

File diff suppressed because it is too large

10
config/bootstrap.php

@ -4,14 +4,14 @@ use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/vendor/autoload.php';
if (!class_exists(Dotenv::class)) {
throw new LogicException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
}
// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) {
foreach ($env as $k => $v) {
$_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v);
}
} elseif (!class_exists(Dotenv::class)) {
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
(new Dotenv(false))->populate($env);
} else {
// load all the .env files
(new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env');

8
config/packages/doctrine_migrations.yaml

@ -1,5 +1,5 @@
doctrine_migrations:
dir_name: '%kernel.project_dir%/src/Migrations'
# namespace is arbitrary but should be different from App\Migrations
# as migrations classes should NOT be autoloaded
namespace: DoctrineMigrations
migrations_paths:
# namespace is arbitrary but should be different from App\Migrations
# as migrations classes should NOT be autoloaded
'DoctrineMigrations': '%kernel.project_dir%/migrations'

1
config/packages/framework.yaml

@ -1,3 +1,4 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html
framework:
secret: '%env(APP_SECRET)%'
#csrf_protection: true

8
config/packages/prod/deprecations.yaml

@ -0,0 +1,8 @@
# As of Symfony 5.1, deprecations are logged in the dedicated "deprecation" channel when it exists
#monolog:
# channels: [deprecation]
# handlers:
# deprecation:
# type: stream
# channels: [deprecation]
# path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log"

8
config/packages/prod/monolog.yaml

@ -14,11 +14,3 @@ monolog:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine"]
deprecation:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log"
deprecation_filter:
type: filter
handler: deprecation
max_level: info
channels: ["php"]

4
config/packages/routing.yaml

@ -1,3 +1,7 @@
framework:
router:
utf8: true
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
#default_uri: http://localhost

3
config/packages/security.yaml

@ -7,7 +7,8 @@ security:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: lazy
anonymous: true
lazy: true
provider: users_in_memory
# activate different ways to authenticate

12
config/services.yaml

@ -16,13 +16,17 @@ services:
# 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}'
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
- '../src/Tests/'
# 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'
resource: '../src/Controller/'
tags: ['controller.service_arguments']
# add more service definitions when explicit configuration is needed
@ -31,4 +35,4 @@ services:
# service pour la generation et l enregistrement du PDF
App\Service\Facture\FactureService:
arguments:
$pdfDirectory: '%factures_directory%'
$pdfDirectory: '%factures_directory%'

0
migrations/.gitignore

0
src/Migrations/Version20200404184835.php → migrations/Version20200404184835.php

7
phpunit.xml.dist

@ -13,6 +13,13 @@
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="7.5" />
<!-- ###+ symfony/framework-bundle ### -->
<env name="APP_ENV" value="dev"/>
<env name="APP_SECRET" value="14f04c76fdcd12e3e239982d27ef8dac"/>
<!-- env name="TRUSTED_PROXIES" value="127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16" -->
<!-- env name="TRUSTED_HOSTS" value="'^(localhost|example\.com)$'" -->
<!-- ###- symfony/framework-bundle ### -->
</php>
<testsuites>

2
public/.htaccess

@ -9,7 +9,7 @@ DirectoryIndex index.php
# feature in your server configuration. Uncomment the following line if you
# install assets as symlinks or if you experience problems related to symlinks
# when compiling LESS/Sass/CoffeScript assets.
# Options FollowSymlinks
# Options +FollowSymlinks
# Disabling MultiViews prevents unwanted negotiation, e.g. "/index" should not resolve
# to the front controller "/index.php" but be rewritten to "/index.php/index".

9
public/index.php

@ -1,10 +1,13 @@
<?php
use App\Kernel;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/config/bootstrap.php';
require dirname(__DIR__).'/vendor/autoload.php';
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
if ($_SERVER['APP_DEBUG']) {
umask(0000);
@ -12,11 +15,11 @@ if ($_SERVER['APP_DEBUG']) {
Debug::enable();
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
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'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}

0
src/Controller/.gitignore

54
src/Kernel.php

@ -3,52 +3,36 @@
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\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
class Kernel extends BaseKernel
{
use MicroKernelTrait;
private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
public function registerBundles(): iterable
protected function configureContainer(ContainerConfigurator $container): void
{
$contents = require $this->getProjectDir().'/config/bundles.php';
foreach ($contents as $class => $envs) {
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
yield new $class();
}
$container->import('../config/{packages}/*.yaml');
$container->import('../config/{packages}/'.$this->environment.'/*.yaml');
if (is_file(\dirname(__DIR__).'/config/services.yaml')) {
$container->import('../config/{services}.yaml');
$container->import('../config/{services}_'.$this->environment.'.yaml');
} elseif (is_file($path = \dirname(__DIR__).'/config/services.php')) {
(require $path)($container->withPath($path), $this);
}
}
public function getProjectDir(): string
protected function configureRoutes(RoutingConfigurator $routes): void
{
return \dirname(__DIR__);
}
$routes->import('../config/{routes}/'.$this->environment.'/*.yaml');
$routes->import('../config/{routes}/*.yaml');
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
{
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
$container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug);
$container->setParameter('container.dumper.inline_factories', 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): void
{
$confDir = $this->getProjectDir().'/config';
$routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
if (is_file(\dirname(__DIR__).'/config/routes.yaml')) {
$routes->import('../config/{routes}.yaml');
} elseif (is_file($path = \dirname(__DIR__).'/config/routes.php')) {
(require $path)($routes->withPath($path), $this);
}
}
}

2
src/Repository/FactureRepository.php

@ -3,8 +3,8 @@
namespace App\Repository;
use App\Entity\Facture;
use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Persistence\ManagerRegistry;
/**
* @method Facture|null find($id, $lockMode = null, $lockVersion = null)

47
symfony.lock

@ -39,16 +39,16 @@
]
},
"doctrine/doctrine-migrations-bundle": {
"version": "1.2",
"version": "2.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.2",
"ref": "c1431086fec31f17fbcfe6d6d7e92059458facc1"
"version": "2.2",
"ref": "baaa439e3e3179e69e3da84b671f0a3e4a2f56ad"
},
"files": [
"./config/packages/doctrine_migrations.yaml",
"./src/Migrations/.gitignore"
"./migrations/.gitignore"
]
},
"doctrine/event-manager": {
@ -159,7 +159,7 @@
"repo": "github.com/symfony/recipes-contrib",
"branch": "master",
"version": "1.0",
"ref": "410b9325a37ef86f1e47262c61738f6202202bca"
"ref": "71599f5b0fdeeeec0fb90e9b17c85e6f5e1350c1"
},
"files": [
"./public/.htaccess"
@ -181,16 +181,15 @@
"version": "v5.0.7"
},
"symfony/console": {
"version": "4.4",
"version": "5.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.4",
"ref": "ea8c0eda34fda57e7d5cd8cbd889e2a387e3472c"
"version": "5.1",
"ref": "c6d02bdfba9da13c22157520e32a602dbee8a75c"
},
"files": [
"./bin/console",
"./config/bootstrap.php"
"./bin/console"
]
},
"symfony/css-selector": {
@ -214,6 +213,9 @@
"symfony/dependency-injection": {
"version": "v5.0.7"
},
"symfony/deprecation-contracts": {
"version": "v2.1.3"
},
"symfony/doctrine-bridge": {
"version": "v5.0.7"
},
@ -257,15 +259,14 @@
"version": "v5.0.7"
},
"symfony/framework-bundle": {
"version": "4.4",
"version": "5.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.4",
"ref": "23ecaccc551fe2f74baf613811ae529eb07762fa"
"version": "5.1",
"ref": "e1b2770f2404d8307450a49cabfc3b2ff3184792"
},
"files": [
"./config/bootstrap.php",
"./config/packages/cache.yaml",
"./config/packages/framework.yaml",
"./config/packages/test/framework.yaml",
@ -288,9 +289,6 @@
"symfony/http-kernel": {
"version": "v5.0.7"
},
"symfony/inflector": {
"version": "v5.0.7"
},
"symfony/intl": {
"version": "v5.0.7"
},
@ -327,10 +325,11 @@
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "877bdb4223245783d00ed1f7429aa7ebc606d914"
"ref": "d7249f7d560f6736115eee1851d02a65826f0a56"
},
"files": [
"./config/packages/dev/monolog.yaml",
"./config/packages/prod/deprecations.yaml",
"./config/packages/prod/monolog.yaml",
"./config/packages/test/monolog.yaml"
]
@ -402,12 +401,12 @@
"version": "v5.0.7"
},
"symfony/routing": {
"version": "4.2",
"version": "5.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.2",
"ref": "683dcb08707ba8d41b7e34adb0344bfd68d248a7"
"version": "5.1",
"ref": "b4f3e7c95e38b606eef467e8a42a8408fc460c43"
},
"files": [
"./config/packages/prod/routing.yaml",
@ -416,12 +415,12 @@
]
},
"symfony/security-bundle": {
"version": "4.4",
"version": "5.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.4",
"ref": "7b4408dc203049666fe23fabed23cbadc6d8440f"
"version": "5.1",
"ref": "0a4bae19389d3b9cba1ca0102e3b2bccea724603"
},
"files": [
"./config/packages/security.yaml"

Loading…
Cancel
Save