https://github.com/s-damian/symfony-crud-example
Symfony 6 (6.2) - Example of CRUD - PHP Framework
https://github.com/s-damian/symfony-crud-example
crud doctrine php php8 symfony symfony6
Last synced: 3 months ago
JSON representation
Symfony 6 (6.2) - Example of CRUD - PHP Framework
- Host: GitHub
- URL: https://github.com/s-damian/symfony-crud-example
- Owner: s-damian
- Created: 2022-12-04T09:03:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-15T07:54:43.000Z (over 2 years ago)
- Last Synced: 2025-01-28T16:44:31.996Z (5 months ago)
- Topics: crud, doctrine, php, php8, symfony, symfony6
- Language: PHP
- Homepage:
- Size: 160 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Example of CRUD with Symfony 6 (6.2)
This example is made by [Stephen Damian](https://github.com/s-damian)
## Requirements
* PHP 8.1 || 8.2
## Summary
In this example of CRUD, there are:
* Examples of Article **Controllers** in **[src/Controller](https://github.com/s-damian/symfony-crud-example/tree/main/src/Controller)** directory.
* Example of Article **Entity** with **[src/Entity/Article.php](https://github.com/s-damian/symfony-crud-example/blob/main/src/Entity/Article.php)** file.
* Example of **Doctrine Event** with **[config/services.yaml](https://github.com/s-damian/symfony-crud-example/tree/main/config/services.yaml)** and **[App/EventListener/ArticleUpdatedListener.php](https://github.com/s-damian/symfony-crud-example/blob/main/src/EventListener/ArticleUpdatedListener.php)** files.
* Example of **Service** with **[src/Service/ActionTexts.php](https://github.com/s-damian/symfony-crud-example/blob/main/src/Service/ActionTexts.php)** file.
* Basic **validations** with **[config/validator/validation.yaml](https://github.com/s-damian/symfony-crud-example/tree/main/config/validator/validation.yaml)** file.
* Examples of Article **templates** in **[templates](https://github.com/s-damian/symfony-crud-example/tree/main/templates)** directory.
* Some basic **tests** (with PHPUnit) in **[tests](https://github.com/s-damian/symfony-crud-example/tree/main/tests)** directory.## Configuration - Symfony App
Clone github repository:
```
git clone [email protected]: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
```## Configuration - Web Server
You have to configure your web server (Linux / Nginx or Apache / MySQL or PostgreSQL / PHP).
## After configuring your Web Server, you can run these demo URLs
* http://www.your-domain.com/admin/articles
* http://www.your-domain.com/admin/articles/create
And you can **Create** / **Read** (listing or show a single article) / **Update** / **Delete** articles.