Used to create new projects using Symfony 6 at XM Media.
Dev: https://symfonystarter.lndo.site @todo-symfony
Staging: @todo-symfony
Production: @todo-symfony
Note: Make sure your git configuration is set to use the correct line endings: git config --global core.autocrlf input && git config --global core.eol lf
- Create a new project:
composer create-project xm/starter_symfony_4 project-name --stability=dev --no-install --remove-vcs
- Add
.env.local
– copy.env
and update. - Update
composer.json
:name
,license
(likelyprivate
) anddescription
- Update
package.json
:name
,version
,git.url
,license
(probably delete),private
- Update the port in
vite.config.js
(server.port
andserver.origin
) - Remove or update the
LICENSE
file. - Composer install & update:
lando composer install && lando composer update
(or removelando
to run without Lando or without memory limit:php -d memory_limit=-1 /usr/local/bin/composer update
) - Run
yarn && yarn up -R "**"
. - Run
yarn dev
oryarn build
(for production) to compile JS & CSS files. - Give executable perms to bin dir:
chmod u+x bin/*
(helpful, but optional) - Run/Start Lando site:
lando start
- Create database with event streams & projections tables from
db_create.sql
usinglando db-import db_create_sql
.- If possible, set database collation to
utf8mb4_bin
:ALTER DATABASE <database_name> CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
- If possible, set database collation to
- Create the required event streams with the command:
bin/console event-store:event-stream:create user && bin/console event-store:event-stream:create auth
(or if using lando:lando console event-store:event-stream:create user && lando console event-store:event-stream:create auth
). - Run all projections once:
bin/console event-store:projection:run user_projection -o
(or if using lando:lando console event-store:projection:run user_projection -o
). - Create a user
bin/console app:user:add
(select roleROLE_SUPER_ADMIN
). - Find and make changes near
@todo-symfony
comments throughout the site. - Delete starter files:
README.md
(or update) andTEMPLATES.md
. - Optional: Run
composer test
– will install PHPUnit & run PHP tests - Create new favicons: realfavicongenerator.net
- Copy (use "Push to another server") or recreate the templates in Postmark. The templates are referenced by the aliases.
- Optional: Run
bin/console app:graphql:dump-schema <username>
to update the GraphQL schema file whereusername
is the email of an admin user. - Optional: Rename the project in PhpStorm.
Local dev site can be accessed at: https://[domain]/
- Checkout the repo.
- Add
.env.local
– copy.env
and update. - Run/Start Lando site:
lando start
- Composer install:
lando composer install
orcomposer install
to run without Lando. - Ensure correct node version:
nvm use
- Run
yarn
. - Run
yarn dev
oryarn build
(for production) to compile JS & CSS files. - Give executable perms to bin dir:
chmod u+x bin/*
(helpful, but optional) - Create database with event streams & projections tables from
db_create.sql
usinglando db-import db_create_sql
.- If possible, set database collation to
utf8mb4_bin
:ALTER DATABASE <database_name> CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
This can be done through PhpMyAdmin (link provided bylando start
command above orlando info
)
- If possible, set database collation to
- Create the required event streams with the command:
bin/console event-store:event-stream:create user && bin/console event-store:event-stream:create auth
(or if using Lando:lando console event-store:event-stream:create user && lando console event-store:event-stream:create auth
). - Run all projections once:
bin/console event-store:projection:run user_projection -o
(or if using Lando:lando console event-store:projection:run user_projection -o
). - Create a user
bin/console app:user:add
(select roleROLE_SUPER_ADMIN
) or if using Lando:lando console app:user:add
- Optional: Run
composer test
– will install PHPUnit & run PHP tests – orlando composer test
if using Lando. - Run
bin/check
to run all code tests/checks.
**Local dev site can be accessed at: https://symfonystarter.lndo.site
- PHP 8.2
- MySQL 5.7+
- Check all code:
bin/check
- Production JS/CSS build:
yarn build
- Dev JS/CSS build:
yarn dev
(recommended command:nvm use && yarn && yarn dev
) - Preview production JS/CSS build:
yarn preview
- JS Tests (Jest):
yarn test:unit
- Linting:
- JS (ESLint):
yarn lint:js
oryarn lint:js:fix
- CSS:
yarn lint:css
oryarn lint:css:fix
- JS (ESLint):
- Install PHP packages:
lando composer install
orcomposer install
- Install JS packages:
yarn
- PHP Tests (PhpUnit):
lando composer test
orcomposer test
- no memory limit
php -d memory_limit=-1 bin/simple-phpunit
- with coverage (HTML)
composer test:coverage
- PHP CS: (must be installed first)
- Dry run:
lando composer cs
orcomposer cs
- Fix:
lando composer cs:fix
orcomposer cs:fix
- Dry run:
- PHP Static Analysis (PHPStan):
lando composer static
orcomposer static
- Projections:
- Show all commands:
bin/console event-store:projection
- Run once:
bin/console event-store:projection:run user_projection -o
- Show all commands:
- Makers (PHP):
- Make aggregate root/model:
bin/console make:model
- Make projection:
bin/console make:projection
- Make aggregate root/model:
- Upgrade JS packages:
yarn up -R "**"
- Upgrade a specific package:
yarn up -R "package-name"
- Upgrade major versions:
yarn upgrade-interactive
(ctrl+c to exit without changes)
- Upgrade a specific package:
- Lando – local dev environment
- Frontend – full list of dependencies can be found in package.json
- Vue – frontend framework
- Vue Router – routing package for frontend
- Vue Templates – the syntax for .vue files
- Vue Test Utils – to help testing Vue components
- Pinia - global state management
- Vite – frontend build tool
- Vitest – to manage & run the frontend testing
- GraphQL – the communication (query) language for the API
- Apollo Client through Vue Apollo – frontend GraphQL
- SASS – CSS preprocessor (uses node-sass)
- PostCSS – transforms CSS
- Autoprefixer – for adding browser prefixes
- SVGO – optimizes SVG files
- Tailwind – utility first styling framework
- Jest – JS unit testing
- Lodash – helper functions for JS
- date-fns – helper functions for Dates in JS
- Vue Final Modal – for modals
- Faker.js – for generating fake data in tests
- ESLint – checks JS for conventions & errors
- Stylelint – checks CSS for conventions & errors
- Vue – frontend framework
- Backend – full list of dependencies can be found in composer.json
- Symfony – backend framework
- GraphQLBundle – provides GraphQL in PHP using graphql-php
- GraphQiL is available at
/graphiql
(on dev only)
- GraphQiL is available at
- Doctrine – ORM
- Doctrine Migrations – for database migrations
- Nelmio CORS Bundle – for CORS
- Symfony Messenger – for async messaging
- Symfony Mailer – for sending emails
- Symfony Security – for authentication & authorization
- Twig – server side templating language (limited use)
- Prooph PDO Event Store & Bridge/Bundle – for doing Event Sourcing
- Doctrine – for reading from read models
- PhpUnit – for running PHP tests
- PHP CS – PHP coding standards analyzer & fixer
- PHPStan – static analysis of PHP
- Postmark – for sending email, contains email templates (currently setup under XM Media's account)
- Cloudflare – DNS & CDN
- GitLab – deployment
- Sentry – error tracking
- Dev Tools