Skip to content

Setup ​

Just enough to get the welcome page running. No Docker lecture unless you want it later.

What you need ​

  • PHP 8.3+ (8.4 is great)
  • Composer 2.x
  • Optional but nice: Symfony CLI (symfony binary) for symfony serve and version checks
  • A database for later chapters: SQLite is perfect for learning (zero babysitting)

Check:

bash
php -v
composer -V
# optional
symfony version

Create a project ​

With Symfony CLI (recommended):

bash
symfony new symfony-playground --webapp
cd symfony-playground

Or plain Composer:

bash
composer create-project symfony/skeleton symfony-playground
cd symfony-playground
composer require webapp

Comments for the code above:

  • --webapp / webapp pulls Twig, Doctrine, form, security, AssetMapper, etc. - the "I want a website" pack
  • Flex recipes write config under config/packages/ for you
  • You're looking at a real app skeleton - not a toy framework demo

Run it ​

With Symfony CLI:

bash
symfony serve -d
symfony open:local

Or PHP's built-in server:

bash
php -S 127.0.0.1:8000 -t public

Open the URL - welcome page. Good enough.

In .env / .env.local:

ini
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"

Then when we hit Doctrine:

bash
php bin/console doctrine:database:create
php bin/console doctrine:migrations:migrate

MySQL/Postgres work fine too - more moving parts for day one.

Console is your friend ​

bash
php bin/console list
php bin/console about
php bin/console debug:router

about is a nice sanity dump. debug:router is the Symfony equivalent of "show me the router table".

Editor ​

  • PHP Intelephense / Symfony Support extensions - whatever helps autocomplete services and routes
  • Don't commit .env.local - commit .env templates / .env.dist patterns your team uses

Once the welcome page loads, you're set. Next: where everything lives.

Best,

-- ł.

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