Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
<?php
// see https://github.com/FriendsOfPHP/PHP-CS-Fixer

$finder = (new PhpCsFixer\Finder())
$finder = new PhpCsFixer\Finder()
->in([__DIR__.'/src', __DIR__.'/tests'])
;

return (new PhpCsFixer\Config())
return new PhpCsFixer\Config()
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHP82Migration' => true,
'@PHPUnit100Migration:risky' => true,
'@PHP8x5Migration' => true,
'@PHP8x5Migration:risky' => true,
'@PHPUnit11x0Migration:risky' => true,
'declare_strict_types' => false,
'native_function_invocation' => ['include' => ['@all']],
'native_function_invocation' => ['include' => ['@internal']],
'method_chaining_indentation' => true,
'fopen_flags' => ['b_mode' => true],
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'trailing_comma_in_multiline' => ['elements' => ['arguments', 'arrays', 'match', 'parameters']],
])
->setFinder($finder)
Expand Down
4 changes: 1 addition & 3 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"scss/double-slash-comment-empty-line-before": null,
"scss/no-global-function-names": null,
"at-rule-no-unknown": null,
"indentation": 4,
"no-descending-specificity": null,
"selector-list-comma-newline-after": "never-multi-line"
"no-descending-specificity": null
}
}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ cs: ## execute fix coding standard (requires php-cs-fixer locally installed)
${EXEC} -e XDEBUG_MODE=off php bin/php-cs-fixer fix -v

twigcs: ## execute fix twig coding standard
${EXEC} -e XDEBUG_MODE=off php bin/twig-cs-fixer lint templates
${EXEC} -e XDEBUG_MODE=off php bin/twig-cs-fixer lint templates --fix

stan: ## execute static analysis (requires phpstan locally installed)
${EXEC} -e XDEBUG_MODE=off php bin/phpstan analyse -v
Expand Down
27 changes: 7 additions & 20 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
#!/usr/bin/env php
<?php

set_time_limit(0);
use Infrastructure\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;

require __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/../vendor/autoload_runtime.php';

$input = new Symfony\Component\Console\Input\ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}
return static function (array $context): Application {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);

if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}

if ($_SERVER['APP_DEBUG']) {
umask(0000);
if (class_exists(Symfony\Component\ErrorHandler\Debug::class)) {
Symfony\Component\ErrorHandler\Debug::enable();
}
}

$kernel = new Infrastructure\Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Symfony\Bundle\FrameworkBundle\Console\Application($kernel);
$application->run($input);
return new Application($kernel);
};
57 changes: 31 additions & 26 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "beelab/symfony-beelab",
"type": "project",
"description": "Adapt this file with your actual project content",
"license": "MIT",
"type": "project",
"authors": [
{
"name": "Massimiliano Arione",
Expand All @@ -14,30 +14,31 @@
}
],
"require": {
"php": "^8.3",
"php": "^8.4",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-intl": "*",
"ext-mbstring": "*",
"symfony/flex": "^2.5"
"symfony/flex": "^2.10"
},
"flex-require": {
"doctrine/doctrine-bundle": "^2.14",
"doctrine/orm": "^3.3",
"doctrine/doctrine-bundle": "^3.1",
"doctrine/orm": "^3.5",
"ramsey/uuid-doctrine": "^2.1",
"symfony/asset": "^6.4",
"symfony/console": "^6.4",
"symfony/form": "^6.4",
"symfony/framework-bundle": "^6.4",
"symfony/mailer": "^6.4",
"symfony/messenger": "^6.4",
"symfony/monolog-bundle": "^3.10",
"symfony/security-bundle": "^6.4",
"symfony/translation": "^6.4",
"symfony/twig-bundle": "^6.4",
"symfony/validator": "^6.4",
"symfony/web-link": "^6.4",
"symfony/yaml": "^6.4"
"symfony/asset": "^7.4",
"symfony/console": "^7.4",
"symfony/form": "^7.4",
"symfony/framework-bundle": "^7.4",
"symfony/mailer": "^7.4",
"symfony/messenger": "^7.4",
"symfony/monolog-bundle": "^4.0",
"symfony/runtime": "^7.4",
"symfony/security-bundle": "^7.4",
"symfony/translation": "^7.4",
"symfony/twig-bundle": "^7.4",
"symfony/validator": "^7.4",
"symfony/web-link": "^7.4",
"symfony/yaml": "^7.4"
},
"replace": {
"symfony/polyfill-ctype": "*",
Expand All @@ -51,18 +52,19 @@
"symfony/polyfill-php80": "*",
"symfony/polyfill-php81": "*",
"symfony/polyfill-php82": "*",
"symfony/polyfill-php83": "*"
"symfony/polyfill-php83": "*",
"symfony/polyfill-php84": "*"
},
"flex-require-dev": {
"beelab/test-bundle": "^7.0",
"dama/doctrine-test-bundle": "^8.3",
"beelab/test-bundle": "^7.2",
"dama/doctrine-test-bundle": "^8.4",
"deployer/deployer": "^7.5",
"doctrine/doctrine-fixtures-bundle": "^4.1",
"phpunit/phpunit": "^12.1",
"doctrine/doctrine-fixtures-bundle": "^4.3",
"phpunit/phpunit": "^12.5",
"symfony/debug-bundle": "^6.4",
"symfony/phpunit-bridge": "^7.2",
"symfony/phpunit-bridge": "^7.4",
"symfony/profiler-pack": "^1.0",
"vincentlanglet/twig-cs-fixer": "^3.6"
"vincentlanglet/twig-cs-fixer": "^3.11"
},
"config": {
"allow-plugins": {
Expand All @@ -73,9 +75,12 @@
"sort-packages": true
},
"extra": {
"runtime": {
"disable_dotenv": true
},
"symfony": {
"allow-contrib": true,
"require": "^6.4"
"require": "^7.4"
}
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion config/docker/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nginx:1.25
FROM nginx:1

RUN apt update && apt install -y --no-install-recommends curl

Expand Down
13 changes: 2 additions & 11 deletions config/docker/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
server {
server_name customize.local *.ngrok.io;
server_name customize.local *.ngrok-free.app;
root /user/customize/public;

client_max_body_size 300M;
Expand Down Expand Up @@ -32,17 +32,8 @@ server {
fastcgi_pass php:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
# When you are using symlinks to link the document root to the
# current version of your application, you should pass the real
# application path instead of the path to the symlink to PHP FPM.
# Otherwise, PHP's OPcache may not properly detect changes to your
# PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
# for more information).
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
# Prevents URIs that include the front controller. This will 404:
# http://symfony3.dev/index.php/some-path
# Remove the internal directive to allow URIs like this
#internal;
internal;
}
}
12 changes: 8 additions & 4 deletions config/docker/php-fpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM composer:2.8 AS composer
FROM php:8.3-fpm
FROM composer:2.9 AS composer
FROM php:8.5-fpm

ARG HOST_UID

Expand All @@ -13,9 +13,13 @@ RUN rm /etc/localtime && ln -s /usr/share/zoneinfo/Europe/Rome /etc/localtime
RUN apt update && apt install -y --no-install-recommends zlib1g-dev libicu-dev g++ vim default-mysql-client libxslt1-dev libxrender1 libxext6 libfontconfig libjpeg-dev libonig-dev nodejs npm
RUN docker-php-ext-install pdo pdo_mysql intl mysqli iconv xsl

# Install PIE
RUN curl --output /usr/bin/pie --location https://github.com/php/pie/releases/download/1.3.1/pie.phar \
&& chmod +x /usr/bin/pie

# Install xdebug
RUN pecl install xdebug-3.4.2 && docker-php-ext-enable xdebug
RUN { \
RUN pie install xdebug/xdebug && docker-php-ext-enable xdebug \
&& { \
echo 'error_reporting = E_ALL'; \
echo 'display_startup_errors = On'; \
echo 'display_errors = On'; \
Expand Down
2 changes: 1 addition & 1 deletion config/packages/cache.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
framework:
cache:
# Unique name of your app: used to compute stable namespaces for cache keys.
#prefix_seed: your_vendor_name/app_name
prefix_seed: beelab/customize

# The "app" cache stores to the filesystem by default.
# The data in this cache should persist between deploys.
Expand Down
5 changes: 0 additions & 5 deletions config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ doctrine:
url: '%env(resolve:APP_DATABASE_URL)%'
server_version: '8.0.31'
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: false
validate_xml_mapping: true
enable_lazy_ghost_objects: true
controller_resolver:
auto_mapping: false
# uncomment after having added at least one entity and/or VO
# mappings:
# entity:
Expand All @@ -33,7 +29,6 @@ when@test:
dbal:
dbname_suffix: '_test'
logging: false
use_savepoints: true

when@prod:
doctrine:
Expand Down
5 changes: 5 additions & 0 deletions config/packages/routing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ framework:
# 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

when@dev:
framework:
router:
default_uri: 'http://customize.local:8080/'
2 changes: 1 addition & 1 deletion config/routes/dev/framework.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
_errors:
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
resource: '@FrameworkBundle/Resources/config/routing/errors.php'
prefix: /_error
4 changes: 2 additions & 2 deletions config/routes/dev/web_profiler.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
resource: '@WebProfilerBundle/Resources/config/routing/profiler.php'
prefix: /_profiler

_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
resource: '@WebProfilerBundle/Resources/config/routing/wdt.php'
prefix: /_wdt
1 change: 1 addition & 0 deletions deploy.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
set('shared_dirs', ['var/log']);
set('writable_dirs', ['var', 'var/log']);
set('release_name', static fn (): string => \date('ymdHi'));
set('composer_options', '--no-progress --no-interaction --no-dev --classmap-authoritative --apcu-autoloader');

desc('Update database');
task('deploy:db:update', static function (): void {
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
database:
image: mysql:8.0
image: mysql:8.4
environment:
- MYSQL_ROOT_PASSWORD=root
php:
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
"stylelint": "stylelint -f verbose ./assets/scss/*.scss"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^6.7.2",
"@fortawesome/fontawesome-free": "^7.1.0",
"@popperjs/core": "^2.11.8",
"bootstrap": "^5.3.5"
"bootstrap": "^5.3.8"
},
"devDependencies": {
"@babel/core": "^7.27.1",
"@babel/preset-env": "^7.27.1",
"@symfony/webpack-encore": "^5.1.0",
"eslint": "^9.25.0",
"sass": "^1.86.3",
"sass-loader": "^16.0.5",
"stylelint": "^16.19.1",
"stylelint-config-standard": "^38.0.0",
"stylelint-config-standard-scss": "^14.0.0"
"@babel/core": "^7.28.5",
"@babel/preset-env": "^7.28.5",
"@symfony/webpack-encore": "^5.3.1",
"eslint": "^9.39.1",
"sass": "^1.96.0",
"sass-loader": "^16.0.6",
"stylelint": "^16.26.1",
"stylelint-config-standard": "^39.0.1",
"stylelint-config-standard-scss": "^16.0.0"
},
"author": "Massimiliano Arione",
"homepage": "https://github.com/bee-lab"
Expand Down
4 changes: 2 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://docs.phpunit.de/en/12.0/configuration.html -->
<!-- https://docs.phpunit.de/en/12.5/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="tests/bootstrap.php"
bootstrap="vendor/autoload.php"
colors="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
>
Expand Down
23 changes: 3 additions & 20 deletions public/index.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
<?php

use Symfony\Component\HttpFoundation\Request;
use Infrastructure\Kernel;

require __DIR__.'/../vendor/autoload.php';
require __DIR__.'/../vendor/autoload_runtime.php';

if ($_SERVER['APP_DEBUG'] ?? false) {
umask(0000);
Symfony\Component\ErrorHandler\Debug::enable();
}

if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_FOR ^ Request::HEADER_X_FORWARDED_HOST);
}

if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}

$kernel = new Infrastructure\Kernel($_SERVER['APP_ENV'] ?? 'prod', $_SERVER['APP_DEBUG'] ?? false);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
return static fn (array $context): Kernel => new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
2 changes: 1 addition & 1 deletion templates/layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</main>
<footer class="footer mt-auto py-3">
<div class="container">
<p class="text-muted">© 2024 <a href="https://github.com/bee-lab/">BeeLab</a></p>
<p class="text-muted">© 2025 <a href="https://github.com/bee-lab/">BeeLab</a></p>
</div>
</footer>
</body>
Expand Down
1 change: 0 additions & 1 deletion tests/Controller/DefaultControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Test;


#[Group('functional')]
final class DefaultControllerTest extends WebTestCase
{
Expand Down
Loading