Skip to content

Commit f38a3ee

Browse files
committed
Convert from Silex to Symfony 4 flex
1 parent 0f7c88b commit f38a3ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1443
-1666
lines changed

.env.dev

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# TRELLIS_SOURCE_DIR = ''
2+
TRELLIS_CONFIG_DIR = '../'

.env.dist

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# TRELLIS_SOURCE_DIR='/path/to/files/to/serve'
2+
# TRELLIS_CONFIG_DIR='/path/to/directory/with/settings.yml'

.env.test

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TRELLIS_CONFIG_DIR='./test/resources/config'

.gitignore

+16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
vendor/
22
config/settings.yml
3+
settings.yml
34
composer.lock
45
.buildpath
56
.project
@@ -8,3 +9,18 @@ composer.phar
89
coverage.xml
910
.DS_Store
1011

12+
###> symfony/phpunit-brige ###
13+
/bin/.phpunit
14+
###< symfony/phpunit-bridge ###
15+
16+
###> symfony/framework-bundle ###
17+
/.env.local
18+
/.env.*.local
19+
/public/bundles/
20+
/var/
21+
/vendor/
22+
###< symfony/framework-bundle ###
23+
24+
###> symfony/web-server-bundle ###
25+
/.web-server-pid
26+
###< symfony/web-server-bundle ###

bin/console

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
use App\Kernel;
5+
use Symfony\Bundle\FrameworkBundle\Console\Application;
6+
use Symfony\Component\Console\Input\ArgvInput;
7+
use Symfony\Component\Debug\Debug;
8+
9+
set_time_limit(0);
10+
11+
require dirname(__DIR__).'/vendor/autoload.php';
12+
13+
if (!class_exists(Application::class)) {
14+
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
15+
}
16+
17+
$input = new ArgvInput();
18+
if (null !== $_ENV['APP_ENV'] = $input->getParameterOption(['--env', '-e'], null, true)) {
19+
putenv('APP_ENV='.$_ENV['APP_ENV']);
20+
// force loading .env files when --env is defined
21+
$_SERVER['APP_ENV'] = null;
22+
}
23+
24+
if ($input->hasParameterOption('--no-debug', true)) {
25+
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
26+
}
27+
28+
require dirname(__DIR__).'/src/.bootstrap.php';
29+
30+
if ($_SERVER['APP_DEBUG']) {
31+
umask(0000);
32+
33+
if (class_exists(Debug::class)) {
34+
Debug::enable();
35+
}
36+
}
37+
38+
$kernel = new Kernel($_SERVER['APP_ENV'], $_SERVER['APP_DEBUG']);
39+
$application = new Application($kernel);
40+
$application->run($input);

bin/phpunit

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
5+
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
6+
exit(1);
7+
}
8+
9+
if (false === getenv('SYMFONY_PHPUNIT_VERSION')) {
10+
putenv('SYMFONY_PHPUNIT_VERSION=6.5');
11+
}
12+
if (false === getenv('SYMFONY_PHPUNIT_REMOVE')) {
13+
putenv('SYMFONY_PHPUNIT_REMOVE=');
14+
}
15+
if (false === getenv('SYMFONY_PHPUNIT_DIR')) {
16+
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
17+
}
18+
19+
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';

composer.json

+53-8
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,71 @@
77
"license": "Apache-2.0",
88
"require": {
99
"php": ">=7.1.0",
10-
"silex/silex": "^2.0",
11-
"symfony/config": "^3.4",
12-
"symfony/yaml": "^3.4",
10+
"ext-ctype": "*",
11+
"ext-iconv": "*",
12+
"symfony/console": "4.1.*",
13+
"symfony/flex": "^1.1",
14+
"symfony/framework-bundle": "4.1.*",
15+
"symfony/yaml": "4.1.*",
1316
"easyrdf/easyrdf": "^0.9.1",
1417
"ml/json-ld": "^1.1",
15-
"twig/twig": "^1.33"
18+
"symfony/twig-bundle": "4.1.*"
1619
},
1720
"require-dev": {
21+
"symfony/dotenv": "4.1.*",
22+
"symfony/web-server-bundle": "4.1.*",
1823
"squizlabs/php_codesniffer": "^3.2",
19-
"symfony/browser-kit": "^3.4",
20-
"phpunit/phpunit": "^5.7"
24+
"symfony/browser-kit": "4.1.*",
25+
"symfony/phpunit-bridge": "4.1.*"
26+
},
27+
"config": {
28+
"preferred-install": {
29+
"*": "dist"
30+
},
31+
"sort-packages": true
2132
},
2233
"autoload": {
23-
"psr-4": {"Trellis\\StaticLdp\\": "src/"}
34+
"psr-4": {
35+
"App\\": "src/"
36+
}
37+
},
38+
"autoload-dev": {
39+
"psr-4": {
40+
"App\\Tests\\": "test/"
41+
}
42+
},
43+
"replace": {
44+
"paragonie/random_compat": "2.*",
45+
"symfony/polyfill-ctype": "*",
46+
"symfony/polyfill-iconv": "*",
47+
"symfony/polyfill-php71": "*",
48+
"symfony/polyfill-php70": "*",
49+
"symfony/polyfill-php56": "*"
2450
},
2551
"scripts": {
26-
"check": "phpcs --standard=PSR2 src test index.php",
52+
"auto-scripts": {
53+
"cache:clear": "symfony-cmd",
54+
"assets:install %PUBLIC_DIR%": "symfony-cmd"
55+
},
56+
"post-install-cmd": [
57+
"@auto-scripts"
58+
],
59+
"post-update-cmd": [
60+
"@auto-scripts"
61+
],
62+
"check": "phpcs --standard=PSR2 src test",
2763
"test": [
2864
"@check",
2965
"phpunit"
3066
]
67+
},
68+
"conflict": {
69+
"symfony/symfony": "*"
70+
},
71+
"extra": {
72+
"symfony": {
73+
"allow-contrib": false,
74+
"require": "4.1.*"
75+
}
3176
}
3277
}

0 commit comments

Comments
 (0)