adjusting framework to load dev toolbar

This commit is contained in:
ayman
2025-11-09 02:00:15 +00:00
parent 154b1fef82
commit e51251521e
10 changed files with 445 additions and 405 deletions

1
.gitignore vendored
View File

@@ -7,4 +7,5 @@
/public/bundles/
/var/
/vendor/
/.idea/
###< symfony/framework-bundle ###

View File

@@ -1,27 +1,28 @@
{
"name": "appsynchq/expenses",
"type": "project",
"description": "Expenses app migrated to Symfony 6.4 LTS",
"description": "Expenses app upgraded to Symfony 7.0",
"license": "MIT",
"require": {
"php": ">=8.1",
"php": ">=8.2",
"ext-pdo": "*",
"symfony/framework-bundle": "^6.4",
"symfony/http-foundation": "^6.4",
"symfony/routing": "^6.4",
"symfony/dependency-injection": "^6.4",
"symfony/yaml": "^6.4",
"symfony/twig-bundle": "^6.4",
"symfony/runtime": "^6.4",
"symfony/console": "^6.4",
"symfony/security-bundle": "^6.4",
"symfony/framework-bundle": "^7.0",
"symfony/http-foundation": "^7.0",
"symfony/routing": "^7.0",
"symfony/dependency-injection": "^7.0",
"symfony/yaml": "^7.0",
"symfony/twig-bundle": "^7.0",
"symfony/runtime": "^7.0",
"symfony/console": "^7.0",
"symfony/security-bundle": "^7.0",
"symfony/orm-pack": "^2.4",
"symfony/dotenv": "^6.4"
"symfony/dotenv": "^7.0"
},
"require-dev": {
"symfony/var-dumper": "^6.4",
"symfony/var-dumper": "^7.0",
"symfony/maker-bundle": "^1.64",
"symfony/web-profiler-bundle": "^6.4"
"symfony/web-profiler-bundle": "^7.0",
"symfony/profiler-pack": "^1.0"
},
"autoload": {
"psr-4": {

760
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
when@dev:
web_profiler:
toolbar: true
intercept_redirects: false
framework:
profiler:
enabled: true
only_exceptions: false

View File

@@ -1,6 +0,0 @@
web_profiler:
toolbar: true
intercept_redirects: false
framework:
profiler: { only_exceptions: false }

View File

@@ -1,7 +1,4 @@
framework:
profiler:
enabled: true
only_exceptions: false
secret: '%env(APP_SECRET)%'
http_method_override: false
handle_all_throwables: true

View File

@@ -8,7 +8,7 @@ controllers:
kernel:
resource: ../src/Kernel.php
type: annotation
type: attribute
when@dev:
imports:

View File

@@ -1,7 +1,7 @@
web_profiler_wdt:
_web_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt
web_profiler_profiler:
_web_profiler_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler

View File

@@ -12,7 +12,6 @@ use Twig\Environment;
class PageController extends AbstractController
{
public function __construct(
private Environment $twig,
private ExpenseService $expenses
) {}
@@ -24,19 +23,9 @@ class PageController extends AbstractController
$today = new DateTimeImmutable('today');
$items = $this->expenses->listByDate($today);
$html = $this->twig->render('daily.html.twig', [
return $this->render('daily.html.twig', [
'today' => $today->format('Y-m-d'),
'items' => $items,
]);
return new Response($html);
}
#[Route('/test', name: 'test', methods: ['GET'])]
public function index(Request $request): Response
{
dump($request->attributes->get('_profiler_token')); // should not be null
exit;
// return $this->render('base.html.twig');
}
}

View File

@@ -2,16 +2,15 @@
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}Expensesasdasdasdasdasdasd App{% endblock %}</title>
{% block stylesheets %}{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
{% if app.debug and app.request and app.request.attributes.get('_profiler_token') %}
{{ render(path('_wdt', { token: app.request.attributes.get('_profiler_token') })) }}
{% endif %}
</body>
<title>{% block title %}Welcome!{% endblock %}</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>">
{% block stylesheets %}
{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
{% block javascripts %}
{% endblock %}
</body>
</html>