To learn Symfony was made CRUD with Post / articles.
with similar struture or same idea of:
CodeIgniter 4 - Build Your First Application
on my repo.
https://symfony.com/doc/current/
Official Packages installed on the project:
minimal instalation:
composer create-project symfony/skeleton ./
packages like doctrine, twig, form, etc.
composer require webapp
composer require symfony/apache-pack
info: https://symfony.com/doc/current/setup/web_server_configuration.html#adding-rewrite-rules-for-apache
composer require annotations
composer require profiler
composer require --dev symfony/debug-bundle
composer require symfony/asset
composer require symfony/security-csrf
in public/index.php
:
return function (array $context) {
#https://symfony.com/doc/current/reference/configuration/framework.html#http-method-override
Request::enableHttpMethodParameterOverride(); // <-- add this line
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};
composer require symfony/orm-pack
composer require --dev symfony/maker-bundle
composer require symfony/validator
It is needed this pack because without it, will return empty objects. Since what you fetch is Entity base object, not stand object ( stdclass). This only need if you are using ORM like Doctrine base entity. If you are using from a Query build, may not be needed.
composer require symfony/serializer-pack
-
Editor: VS Code (By Microsoft)
-
PHP Intelephense (By Ben Mewburn)
-
PHP Namespace Resolver (By Mehedi Hassan)
-
PHP Awesome Snippets (By HakCorp)
-
Twig Pack (by Bajdzis)
-
To better developement it is taked advantages of this two wonderfull vscode extensions:
- Docker (By Microsoft): to manage docker containers in vs code
- Dev Containers (By Microsoft): to use vscode inside of the container.
php image: read the Dockerfile
mysql image in terminal:
docker run --name db_sf \
-e MYSQL_ROOT_PASSWORD=[your pwd] \
-e MYSQL_DATABASE=sf6 \
-e MYSQL_USER=[youur user] \
-e MYSQL_PASSWORD=[your password] \
-dp 3306:3306 mysql;