xm / starter_symfony_4
Starter for creating Symfony 4/5/6 sites at XM Media
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 6
Forks: 3
Open Issues: 9
Type:project
Requires
- php: ~8.2.0
- ext-ctype: *
- ext-iconv: *
- ext-json: *
- ext-pcntl: *
- ext-pdo: *
- doctrine/doctrine-bundle: ^2.4
- doctrine/doctrine-migrations-bundle: ^3.1
- doctrine/orm: ^2.10
- egulias/email-validator: ^4.0
- knplabs/knp-paginator-bundle: ^6.0
- moneyphp/money: ^4.0
- nelmio/cors-bundle: ^2.3
- nesbot/carbon: ^3.0
- odolbeau/phone-number-bundle: ^3.0
- overblog/graphql-bundle: ^1.0
- pentatrion/vite-bundle: ^6.0.0
- phpdocumentor/reflection-docblock: ^5.2
- phpoffice/phpspreadsheet: ^2.0
- prooph/event-store-bus-bridge: ^3.3
- prooph/event-store-symfony-bundle: ^0.11
- prooph/pdo-event-store: 1.15.0
- ramsey/uuid: ^4.0
- ramsey/uuid-doctrine: ^2.0
- roave/security-advisories: dev-master
- scienta/doctrine-json-functions: ^5.0
- sentry/sentry-symfony: ^4.7
- symfony/asset: *
- symfony/console: *
- symfony/doctrine-messenger: *
- symfony/dotenv: *
- symfony/expression-language: *
- symfony/flex: ^2.0
- symfony/form: *
- symfony/framework-bundle: *
- symfony/http-client: ~6.4.0
- symfony/mailer: *
- symfony/messenger: *
- symfony/monolog-bundle: ^3.5
- symfony/postmark-mailer: *
- symfony/process: *
- symfony/property-access: *
- symfony/property-info: *
- symfony/proxy-manager-bridge: *
- symfony/runtime: *
- symfony/security-bundle: *
- symfony/serializer: *
- symfony/string: *
- symfony/templating: *
- symfony/translation: *
- symfony/twig-bundle: *
- symfony/validator: *
- symfony/web-link: *
- symfony/yaml: *
- symfonycasts/reset-password-bundle: ^1.20
- tecnickcom/tcpdf: ^6.6
- twig/extra-bundle: ^3.0
- twig/twig: ^3.5
- webmozart/assert: ^1.3
- xm/symfony-bundle: ^2.0
Requires (Dev)
- doctrine/doctrine-fixtures-bundle: ^3.0
- ekino/phpstan-banned-code: ^2.0
- ergebnis/composer-normalize: ^2.43
- fakerphp/faker: ^1.8
- friendsofphp/php-cs-fixer: ^3.0
- jetbrains/phpstorm-attributes: ^1.0
- liip/functional-test-bundle: ^4.1
- marc-mabe/php-enum-phpstan: ^2.0
- mockery/mockery: ^1.2
- overblog/graphiql-bundle: ^0.3.0
- phpstan/phpstan: ^1.0
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-mockery: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpstan/phpstan-symfony: ^1.0
- phpstan/phpstan-webmozart-assert: ^1.0
- phpunit/phpunit: ^9.5
- rector/rector: ^1.0
- symfony/apache-pack: ^1.0
- symfony/browser-kit: *
- symfony/css-selector: *
- symfony/debug-bundle: *
- symfony/maker-bundle: ^1.0
- symfony/phpunit-bridge: *
- symfony/stopwatch: *
- symfony/web-profiler-bundle: *
- theofidry/alice-data-fixtures: ^1.1
Conflicts
Replaces
- paragonie/random_compat: ^2.0
- symfony/polyfill-ctype: *
- symfony/polyfill-iconv: *
- symfony/polyfill-php56: *
- symfony/polyfill-php70: *
- symfony/polyfill-php71: *
- symfony/polyfill-php72: *
- symfony/polyfill-php73: *
- symfony/polyfill-php74: *
- symfony/polyfill-php80: *
- symfony/polyfill-php81: *
- symfony/polyfill-php82: *
This package is auto-updated.
Last update: 2024-11-20 05:22:17 UTC
README
Used to create new projects using Symfony 6 at XM Media.
Dev: https://symfonystarter.lndo.site @todo-symfony
Staging: @todo-symfony
Production: @todo-symfony
Setting Up a New Site
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]/
Setting Up Starter
- 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
System Requirements
Server
- PHP 8.2
- MySQL 5.7+
Locally for Development
Commands
- 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:
Incorporated Libraries & Tools
- 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