Skip to content

Commit 12c41a4

Browse files
committed
feat: migrate to Symfony
Signed-off-by: Vitor Mattos <vitor@php.rio>
1 parent d37d077 commit 12c41a4

File tree

145 files changed

+4260
-3035
lines changed

Some content is hidden

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

145 files changed

+4260
-3035
lines changed

.docker/web/nginx.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ server {
2727
include fastcgi_params;
2828
fastcgi_param SCRIPT_FILENAME $document_root/public$fastcgi_script_name;
2929
fastcgi_param PATH_INFO $fastcgi_path_info;
30+
31+
fastcgi_read_timeout 6000s;
32+
fastcgi_send_timeout 6000s;
33+
fastcgi_connect_timeout 6000s;
3034
}
3135

3236
# If someone explicitly tries to load a PHP file return a 404 error,

.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ XDEBUG_CONFIG="client_host=172.17.0.1 client_port=9003 start_with_request=yes"
1111

1212
APP_DEBUG=true
1313

14-
DB_URL=pdo-mysql://root:root@mysql/report
15-
DB_URL_AKAUNTING=pdo-mysql://root:root@host.docker.internal/akaunting
14+
DATABASE_URL=pdo-mysql://root:root@mysql/report
15+
DATABASE_AKAUNTING_URL=pdo-mysql://root:root@host.docker.internal/akaunting
1616

1717
MYSQL_HOST=mysql
1818
MYSQL_ROOT_PASSWORD=root

.github/workflows/phpunit.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ jobs:
1919
runs-on: ubuntu-latest
2020

2121
env:
22-
DB_URL: pdo-mysql://root:root@127.0.0.1:4444/report
23-
DB_URL_AKAUNTING: pdo-mysql://root:root@127.0.0.1:4444/akaunting
22+
APP_ENV: test
23+
DATABASE_URL: pdo-mysql://root:root@127.0.0.1:4444/report
24+
DATABASE_AKAUNTING_URL: pdo-mysql://root:root@127.0.0.1:4444/akaunting
2425
AKAUNTING_COMPANY_ID: 1
2526
AKAUNTING_FRRA_MES_PADRAO: 12
2627
AKAUNTING_RESGATE_SALDO_IRPF_MES_PADRAO: 12
@@ -78,12 +79,14 @@ jobs:
7879
- name: Set up database
7980
env:
8081
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81-
run: php ./bin/import migrations:migrate -n
82+
run: |
83+
> .env
84+
php ./bin/console doctrine:migrations:migrate -n
8285
8386
- name: PHPUnit
8487
run: composer run test:unit
8588

8689
- name: Print logs
8790
if: always()
8891
run: |
89-
cat storage/logs/system.log
92+
cat var/log/test.log

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
###> symfony/framework-bundle ###
2+
/.env.local
3+
/.env.local.php
4+
/.env.*.local
5+
/config/secrets/prod/prod.decrypt.private.php
6+
/public/bundles/
7+
/var/
8+
/vendor/
9+
###< symfony/framework-bundle ###
110
/volumes/
211
/vendor-bin/**/vendor/
3-
/vendor/
412
/storage/
513
.vscode
614
.env

.php-cs-fixer.dist.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,14 @@
2727

2828
$config = new PhpCsFixer\Config();
2929
$config
30-
->getFinder()
31-
->ignoreVCSIgnored(true)
32-
->notPath('logs')
33-
->notPath('vendor')
34-
->notPath('vendor-bin')
35-
->in(__DIR__);
30+
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
31+
->setRules(array_merge($config->getRules(), [
32+
'no_unused_imports' => true,
33+
]))
34+
->getFinder()
35+
->ignoreVCSIgnored(true)
36+
->notPath('logs')
37+
->notPath('vendor')
38+
->notPath('vendor-bin')
39+
->in(__DIR__);
3640
return $config;

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Em outro terminal:
8181
```bash
8282
docker compose exec php bash
8383
composer install
84-
php ./bin/import migrations:migrate -n
84+
php ./bin/console doctrine:migrations:migrate -n
8585
```
8686

8787
## Comandos

bin/console

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
use App\Kernel;
5+
use Symfony\Bundle\FrameworkBundle\Console\Application;
6+
use Symfony\Component\Dotenv\Dotenv;
7+
8+
if (!is_dir(dirname(__DIR__).'/vendor')) {
9+
throw new LogicException('Dependencies are missing. Try running "composer install".');
10+
}
11+
12+
if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
13+
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
14+
}
15+
16+
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
17+
18+
if (file_exists(__DIR__.'/../.env')) {
19+
$dotenv = new Dotenv();
20+
$dotenv->usePutenv()->loadEnv(__DIR__.'/../.env', overrideExistingVars: true);
21+
}
22+
23+
return function (array $context) {
24+
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
25+
26+
return new Application($kernel);
27+
};

bin/import

Lines changed: 0 additions & 25 deletions
This file was deleted.

bin/import.php

Lines changed: 0 additions & 35 deletions
This file was deleted.

composer.json

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,50 @@
22
"type": "project",
33
"license": "AGPL-3.0-or-later",
44
"require": {
5-
"cmixin/business-day": "^1.16",
6-
"doctrine/dbal": "^3.9",
7-
"doctrine/migrations": "^3.8",
8-
"doctrine/orm": "^3.3",
9-
"doctrine/sql-formatter": "^1.5",
10-
"librecodecoop/impostos": "^0.1.0",
11-
"monolog/monolog": "^3.8",
12-
"php-di/php-di": "*",
5+
"cmixin/business-day": "^1.19.3",
6+
"doctrine/doctrine-bundle": "^2.13.2",
7+
"doctrine/doctrine-migrations-bundle": "^3.4.1",
8+
"doctrine/orm": "^3.3.2",
9+
"librecodecoop/impostos": "^0.1.2",
1310
"roukmoute/polyfill-calendar": "^0.5.0",
14-
"symfony/browser-kit": "^7.2",
15-
"symfony/cache": "^7.2",
16-
"symfony/console": "^7.2",
11+
"scienta/doctrine-json-functions": "^6.3",
12+
"symfony/browser-kit": "^7.2.4",
1713
"symfony/css-selector": "^7.2",
18-
"symfony/http-client": "^7.2",
19-
"symfony/http-foundation": "^7.2",
20-
"symfony/mime": "^7.2",
21-
"symfony/routing": "^7.2",
22-
"twig/twig": "^3.20",
23-
"vlucas/phpdotenv": "^5.6"
14+
"symfony/dotenv": "^7.2",
15+
"symfony/framework-bundle": "7.2.*",
16+
"symfony/http-client": "^7.2.4",
17+
"symfony/monolog-bundle": "^3.10",
18+
"symfony/runtime": "^7.2.3",
19+
"symfony/twig-bundle": "^7.2",
20+
"symfony/yaml": "^7.2.3",
21+
"twig/twig": "^3.20"
2422
},
2523
"require-dev": {
26-
"bamarni/composer-bin-plugin": "^1.8",
27-
"doctrine/data-fixtures": "^1.6"
24+
"bamarni/composer-bin-plugin": "^1.8.2",
25+
"doctrine/data-fixtures": "^1.8.1",
26+
"symfony/maker-bundle": "^1.62.1"
2827
},
2928
"autoload": {
3029
"psr-4": {
31-
"ProducaoCooperativista\\": "src/",
32-
"Tests\\Php\\": "tests/php"
30+
"App\\": "src/"
31+
}
32+
},
33+
"autoload-dev": {
34+
"psr-4": {
35+
"App\\Tests\\": "tests/php/"
3336
}
3437
},
3538
"bin": [
36-
"bin/import"
39+
"bin/console"
3740
],
3841
"config": {
3942
"allow-plugins": {
40-
"bamarni/composer-bin-plugin": true
43+
"bamarni/composer-bin-plugin": true,
44+
"php-http/discovery": true,
45+
"symfony/flex": true,
46+
"symfony/runtime": true
4147
},
48+
"bump-after-update": true,
4249
"optimize-autoloader": true,
4350
"classmap-authoritative": true,
4451
"sort-packages": true
@@ -48,6 +55,10 @@
4855
"bin-links": false,
4956
"target-directory": "vendor-bin",
5057
"forward-command": true
58+
},
59+
"symfony": {
60+
"allow-contrib": false,
61+
"require": "7.2.*"
5162
}
5263
},
5364
"scripts": {
@@ -66,5 +77,8 @@
6677
"composer dump-autoload"
6778
],
6879
"test:unit": "vendor-bin/unit/vendor/bin/phpunit -c tests/php/phpunit.xml --color --no-coverage --fail-on-warning --fail-on-risky"
80+
},
81+
"conflict": {
82+
"symfony/symfony": "*"
6983
}
70-
}
84+
}

0 commit comments

Comments
 (0)