Skip to content

Commit

Permalink
Updated the project to Symfony 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Dec 2, 2019
1 parent d2b90fb commit b926e87
Show file tree
Hide file tree
Showing 43 changed files with 1,849 additions and 1,896 deletions.
19 changes: 16 additions & 3 deletions .env
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file
# Set variables here that may be different on each deployment target of the app, e.g. development, staging, production.
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_DEBUG=1
APP_SECRET=67d829bf61dc5f87a73fd814e2c9f629
#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 ###

###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For a MySQL database, use: "mysql://db_user:db_password@127.0.0.1:3306/db_name"
# For a PostgreSQL database, use: "postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11"
# Configure your db driver and server_version in config/packages/doctrine.yaml
DATABASE_URL=sqlite:///%kernel.project_dir%/data/database.sqlite
###< doctrine/doctrine-bundle ###
Expand Down
6 changes: 4 additions & 2 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file will be loaded after .env file and override environment
# variables for your test environment.
# define your env variables for the test env here
APP_SECRET='$ecretf0rt3st'
DATABASE_URL=sqlite:///%kernel.project_dir%/data/database_test.sqlite
KERNEL_CLASS='App\Kernel'
SYMFONY_DEPRECATIONS_HELPER=999999
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/public/bundles/
/var/
Expand All @@ -11,13 +12,9 @@

###> symfony/phpunit-bridge ###
.phpunit
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###

###> symfony/web-server-bundle ###
/.web-server-pid
###< symfony/web-server-bundle ###

###> friendsofphp/php-cs-fixer ###
/.php_cs
/.php_cs.cache
Expand Down
24 changes: 8 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,20 @@ cache:
env:
global:
- SYMFONY_PHPUNIT_DIR=./bin/.phpunit
- SYMFONY_DEPRECATIONS_HELPER=29
- SYMFONY_DEPRECATIONS_HELPER=0
- ACTION="install"

matrix:
fast_finish: true
include:
- php: 7.1.18
- php: 7.2
- php: 7.3
# 'php: nightly' is PHP 8.0
- php: 7.4snapshot
- php: 7.3
env: SYMFONY="4.4.*"
ACTION="update"
- php: 7.3
env: SYMFONY="5.0.*"
ACTION="update"
# 'php: nightly' is PHP 8.0
- php: 7.4snapshot
allow_failures:
- php: 7.4snapshot
- php: 7.3
env: SYMFONY="4.4.*"
ACTION="update"
- php: 7.3
env: SYMFONY="5.0.*"
ACTION="update"

before_install:
- '[[ "$TRAVIS_PHP_VERSION" == "7.4snapshot" ]] || phpenv config-rm xdebug.ini'
Expand Down Expand Up @@ -62,9 +51,12 @@ script:
- ./bin/console lint:twig templates --env=prod
# this checks that the XLIFF translations contain no syntax errors
- ./bin/console lint:xliff translations
# this checks that arguments injected into services match type declarations
- ./bin/console lint:container
# TODO: replace the old security checker by the new checker provided by the 'symfony' binary
# this checks that the application doesn't use dependencies with known security vulnerabilities
- ./bin/console security:check
#- ./bin/console security:check
# this checks that Doctrine's mapping configurations are valid
- ./bin/console doctrine:schema:validate --skip-sync -vvv --no-interaction
# Fail CI if the repo is in a dirty state after building assets (only for current release ie install)
- if [[ "$ACTION" == "install" ]]; then yarn install && yarn encore production && git add --all && git diff --staged --exit-code; fi
#- if [[ "$ACTION" == "install" ]]; then yarn install && yarn encore production && git add --all && git diff --staged --exit-code; fi
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Requirements
Installation
------------

Install the [Symfony client][4] binary and run this command:
[Download Symfony][4] to install the `symfony` binary on your computer and run
this command:

```bash
$ symfony new --demo my_project
Expand All @@ -30,17 +31,17 @@ Usage
-----

There's no need to configure anything to run the application. If you have
installed the [Symfony client][4] binary, run this command to run the built-in
web server and access the application in your browser at <http://localhost:8000>:
[installed Symfony][4], run this command and access the application in your
browser at the given URL (<https://localhost:8000> by default):

```bash
$ cd my_project/
$ symfony serve
```

If you don't have the Symfony client installed, run `php bin/console server:run`.
Alternatively, you can [configure a web server][3] like Nginx or Apache to run
the application.
If you don't have the Symfony binary installed, run `php -S localhost:8000 -t public/`
to use the built-in PHP web server or [configure a web server][3] like Nginx or
Apache to run the application.

Tests
-----
Expand All @@ -52,7 +53,7 @@ $ cd my_project/
$ ./bin/phpunit
```

[1]: https://symfony.com/doc/current/best_practices/index.html
[1]: https://symfony.com/doc/current/best_practices.html
[2]: https://symfony.com/doc/current/reference/requirements.html
[3]: https://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html
[4]: https://symfony.com/download
Expand Down
12 changes: 7 additions & 5 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
use Symfony\Component\ErrorHandler\Debug;

if (false === in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI.' SAPI'.\PHP_EOL;
}

set_time_limit(0);

Expand All @@ -15,10 +19,8 @@ if (!class_exists(Application::class)) {
}

$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 (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}

if ($input->hasParameterOption('--no-debug', true)) {
Expand Down
6 changes: 3 additions & 3 deletions bin/phpunit
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env php
<?php

if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}

if (false === getenv('SYMFONY_PHPUNIT_DIR')) {
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
}

require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
51 changes: 24 additions & 27 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,50 @@
"description": "Symfony Demo Application",
"minimum-stability": "stable",
"require": {
"php": "^7.1.3",
"php": "^7.2.9",
"ext-pdo_sqlite": "*",
"doctrine/doctrine-bundle": "^1.6.10",
"doctrine/doctrine-migrations-bundle": "^1.3",
"doctrine/doctrine-bundle": "^1.12|^2.0",
"doctrine/doctrine-migrations-bundle": "^1.3|^2.0",
"doctrine/orm": "^2.5.11",
"erusev/parsedown": "^1.6",
"sensio/framework-extra-bundle": "^5.1",
"sensiolabs/security-checker": "^5.0",
"symfony/asset": "*",
"symfony/console": "*",
"symfony/dotenv": "*",
"symfony/asset": "5.0.*",
"symfony/console": "5.0.*",
"symfony/dotenv": "5.0.*",
"symfony/expression-language": "*",
"symfony/flex": "^1.1",
"symfony/form": "*",
"symfony/form": "5.0.*",
"symfony/framework-bundle": "*",
"symfony/intl": "*",
"symfony/intl": "5.0.*",
"symfony/monolog-bundle": "^3.1",
"symfony/polyfill-intl-messageformatter": "^1.12",
"symfony/polyfill-php72": "^1.8",
"symfony/security-bundle": "*",
"symfony/security-bundle": "5.0.*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/translation": "*",
"symfony/twig-bundle": "*",
"symfony/validator": "*",
"symfony/translation": "5.0.*",
"symfony/twig-bundle": "5.0.*",
"symfony/validator": "5.0.*",
"symfony/webpack-encore-bundle": "^1.4",
"symfony/yaml": "*",
"symfony/yaml": "5.0.*",
"tgalopin/html-sanitizer-bundle": "^1.1",
"twig/extensions": "^1.5",
"twig/twig": "^2.6"
},
"require-dev": {
"dama/doctrine-test-bundle": "^5.0",
"dama/doctrine-test-bundle": "^6.2",
"doctrine/doctrine-fixtures-bundle": "^3.0",
"friendsofphp/php-cs-fixer": "^2.12",
"symfony/browser-kit": "*",
"symfony/css-selector": "*",
"symfony/debug-bundle": "*",
"friendsofphp/php-cs-fixer": "3.0.x-dev",
"symfony/browser-kit": "5.0.*",
"symfony/css-selector": "5.0.*",
"symfony/debug-bundle": "5.0.*",
"symfony/maker-bundle": "^1.11",
"symfony/phpunit-bridge": "*",
"symfony/stopwatch": "*",
"symfony/web-profiler-bundle": "*",
"symfony/web-server-bundle": "*"
"symfony/phpunit-bridge": "5.0.*",
"symfony/stopwatch": "5.0.*",
"symfony/web-profiler-bundle": "5.0.*"
},
"config": {
"platform": {
"php": "7.1.3"
"php": "7.2.9"
},
"preferred-install": {
"*": "dist"
Expand All @@ -70,8 +68,7 @@
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd",
"security-checker security:check": "script"
"assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
Expand All @@ -86,7 +83,7 @@
"extra": {
"symfony": {
"allow-contrib": true,
"require": "4.3.*"
"require": "5.0.*"
}
}
}
Loading

0 comments on commit b926e87

Please sign in to comment.