This example is made by Stephen Damian
- PHP 8.1 || 8.2
In this example of CRUD, there are:
- Examples of Article Controllers in src/Controller directory.
- Example of Article Entity with src/Entity/Article.php file.
- Example of Doctrine Event with config/services.yaml and App/EventListener/ArticleUpdatedListener.php files.
- Example of Service with src/Service/ActionTexts.php file.
- Basic validations with config/validator/validation.yaml file.
- Examples of Article templates in templates directory.
- Some basic tests (with PHPUnit) in tests directory.
Clone github repository:
git clone git@github.com:s-damian/symfony-crud-example.git
In terminal, position yourself in the symfony-crud-example
directory:
cd /your_path/symfony-crud-example/
Create and configure your .env.local
file:
cp .env.local.example .env.local
In your .env.local
file, you need to configure DATABASE_URL
.
Install dependencies with composer:
composer install
Create the database:
php bin/console doctrine:database:create
Run migrations:
php bin/console doctrine:migrations:migrate
You have to configure your web server (Linux / Nginx or Apache / MySQL or PostgreSQL / PHP).
And you can Create / Read (listing or show a single article) / Update / Delete articles.