Skip to content

Commit

Permalink
feat(symfony4-php72) WIP: upgrade symfony 3.3 to 4.x
Browse files Browse the repository at this point in the history
Author:    nicolas-grevin <[email protected]>
  • Loading branch information
nicolas committed Dec 29, 2017
1 parent 3b116a6 commit 268a536
Show file tree
Hide file tree
Showing 75 changed files with 17,761 additions and 2,321 deletions.
15 changes: 14 additions & 1 deletion .env.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# APP
APP_DIR=/var/www/symfony
SYMFONY_ENV=dev
APP_ENV=dev
APP_SECRET=93174013057b1e458ff58ae5f158a0f1

# DOCKER
LOGS_DIR=/docker/logs
Expand All @@ -25,3 +26,15 @@ SMTP_TRANSPORT=

#REDIS
REDIS_DSN=

###> snc/redis-bundle ###
# passwords that contain special characters (@, %, :, +) must be urlencoded
REDIS_URL=redis://localhost
###< snc/redis-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Configure your db driver and server_version in config/packages/doctrine.yaml
DATABASE_URL=mysql://db_user:[email protected]:3306/db_name
###< doctrine/doctrine-bundle ###
20 changes: 10 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,22 @@
### Environement
.env

### Cache, session files and logs (Symfony3)
/var/cache/*
/var/logs/*
!var/cache/.gitkeep
!var/logs/.gitkeep
### Cache, session files and logs (Symfony4)
/var/

### Managed by Composer
/var/bootstrap.php.cache
/vendor/

### Symfony
/public/bundles/

### Assets and user uploads
/web/bundles/
/web/uploads/

### PHPUnit
/phpunit.xml

### Docker
docker/logs/

### NodeJS - NPM - YARN
node_modules/
npm-debug.log*
Expand All @@ -36,4 +32,8 @@ src/AppBundle/Resources/public/js/
src/AppBundle/Resources/public/css/

### Build data
/build/
/build/
###> symfony/phpunit-bridge ###
.phpunit
/phpunit.xml
###< symfony/phpunit-bridge ###
7 changes: 0 additions & 7 deletions app/.htaccess

This file was deleted.

7 changes: 0 additions & 7 deletions app/AppCache.php

This file was deleted.

57 changes: 0 additions & 57 deletions app/AppKernel.php

This file was deleted.

2 changes: 1 addition & 1 deletion app/Resources/views/app.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<body>
{% block data_layout %}
<script type="text/javascript" id="dataLayout">
var dataLayout = {};
let dataLayout = {};
</script>
{% endblock %}
{% block body %}{% endblock %}
Expand Down
4 changes: 2 additions & 2 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ snc_redis:
type: predis
logging: false
alias: session_client
dsn: %redis_dsn%
options: %redis_options%
dsn: '%redis_dsn%'
options: '%redis_options%'
session:
client: session_client
prefix: app_session_
Expand Down
28 changes: 0 additions & 28 deletions app/config/config_dev.yml

This file was deleted.

16 changes: 0 additions & 16 deletions app/config/config_prod.yml

This file was deleted.

18 changes: 0 additions & 18 deletions app/config/config_test.yml

This file was deleted.

2 changes: 1 addition & 1 deletion app/config/parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ parameters:
secret: '%env(SECRET)%'

# Redis parameters
redis_dsn: '%env(REDIS_DSN)%'
redis_dsn: 'redis://%env(REDIS_DSN)%'
redis_options: ~
session_ttl: 86400
4 changes: 2 additions & 2 deletions app/config/routing.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
app:
resource: AppBundle\Controller\AppController
resource: '@AppBundle/Controller/AppController.php'
type: annotation
prefix: /

api:
type: rest
resource: AppBundle\Controller\ApiController
resource: '@AppBundle/Controller/ApiController.php'
prefix: /api
14 changes: 0 additions & 14 deletions app/config/routing_dev.yml

This file was deleted.

24 changes: 0 additions & 24 deletions app/config/security.yml

This file was deleted.

35 changes: 0 additions & 35 deletions app/config/services.yml

This file was deleted.

33 changes: 22 additions & 11 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,28 +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;

// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read https://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
// for more information
//umask(0000);
use Symfony\Component\Dotenv\Dotenv;

set_time_limit(0);

/** @var Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../vendor/autoload.php';
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'], getenv('SYMFONY_ENV') ?: 'dev');
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod';
$env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev');
$debug = ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)) && !$input->hasParameterOption(['--no-debug', '']);

if ($debug) {
Debug::enable();
umask(0000);

if (class_exists(Debug::class)) {
Debug::enable();
}
}

$kernel = new AppKernel($env, $debug);
$kernel = new Kernel($env, $debug);
$application = new Application($kernel);
$application->run($input);
18 changes: 18 additions & 0 deletions bin/phpunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/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";
exit(1);
}
if (false === getenv('SYMFONY_PHPUNIT_REMOVE')) {
putenv('SYMFONY_PHPUNIT_REMOVE=symfony/yaml');
}
if (false === getenv('SYMFONY_PHPUNIT_VERSION')) {
putenv('SYMFONY_PHPUNIT_VERSION=6.5');
}
if (false === getenv('SYMFONY_PHPUNIT_DIR')) {
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
}

require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';
Loading

0 comments on commit 268a536

Please sign in to comment.