Skip to content

Project anatomy ​

As you might have noticed, Symfony's folder tree looks big the first week. Most days you live in five places.

The map (FE brain edition) ​

bash
symfony-playground/
  bin/console          # CLI entry (like artisan)
  config/
    packages/          # Flex-installed package config
    routes/            # route imports (attributes often live on controllers)
    services.yaml      # DI wiring / defaults
  public/              # web root - index.php lives here
  src/
    Controller/
    Entity/            # Doctrine entities (when you add them)
    Repository/
    # Kernel.php, etc.
  templates/           # Twig templates
  assets/              # AssetMapper entrypoints (CSS/JS)
  migrations/          # Doctrine migrations
  tests/
  var/                 # cache, logs (like storage/)
  vendor/              # Composer - like node_modules
  .env                 # defaults
  .env.local           # your machine overrides (gitignored)
  composer.json
  importmap.php        # AssetMapper import map (when present)

Compared to what you know ​

Front-end / PHP tutorialSymfony
src/src/ (honest naming 🙌)
public/index.phppublic/index.php
router fileattributes on controllers (+ config/routes/)
templatestemplates/
Vite resources/assets/ + AssetMapper (or Encore if the project uses it)
.env.env + .env.local
vendor/autoload.phprequired by public/index.php for you

Where to look when debugging ​

  1. URL weird? → php bin/console debug:router / controller #[Route]
  2. HTML weird? → templates/…
  3. DB weird? → src/Entity/… + migrations/
  4. 500 / exception? → var/log/dev.log (or the profiler toolbar)
  5. Service weird? → php bin/console debug:container / config/services.yaml

Services vs "new" (don't panic) ​

You'll see constructors full of type-hints and almost no new Service() in controllers. Symfony's container auto-wires classes under src/ by default - the DI story from the PHP tutorial runway chapter, now automatic.

php
<?php

public function __construct(
    private PostRepository $posts,
) {}

As you can see, it feels like Nest/Angular injectables more than Laravel Facades. Same idea, different aesthetic.

The profiler (dev) ​

When APP_ENV=dev, the web debug toolbar at the bottom is gold: route name, queries, timed events. Click it when something feels slow or mysterious.

Next up: what happens when a request hits public/index.php.

Best,

-- ł.

Continues after /lab/php-tutorial-for-fe-devs/