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 (
symfonybinary) forsymfony serveand version checks - A database for later chapters: SQLite is perfect for learning (zero babysitting)
Check:
bash
php -v
composer -V
# optional
symfony versionCreate a project
With Symfony CLI (recommended):
bash
symfony new symfony-playground --webapp
cd symfony-playgroundOr plain Composer:
bash
composer create-project symfony/skeleton symfony-playground
cd symfony-playground
composer require webappComments for the code above:
--webapp/webapppulls 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:localOr PHP's built-in server:
bash
php -S 127.0.0.1:8000 -t publicOpen the URL - welcome page. Good enough.
SQLite for learning (recommended)
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:migrateMySQL/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:routerabout 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.envtemplates /.env.distpatterns your team uses
Once the welcome page loads, you're set. Next: where everything lives.
Best,
-- ł.