Create basic PHP Symfony5 Restful Microservice CURD API and MySQL part_2-2

0
1725

Overview

How to create php symfony5 Restful microservice CURD api and create MySQL database using doctrine migration commands and PHP Unit Testing (PHPUnit 7.5.20)
Part 2-2

here are symfony Supportive commands which is using in this project
for microservice/api
symfony new sensor_monitor_api
—————————————————–
for run app on localhost server port
symfony server:start
——————–
create new entity/table/model
php bin/console make:entity
—————–
composer require friendsofsymfony/rest-bundle
composer require sensio/framework-extra-bundle
composer require jms/serializer-bundle
composer require symfony/validator
composer require symfony/form
composer require symfony/orm-pack

if while running composer require friendsofsymfony/rest-bundle shows any pre-req error
then after running all above 6 command run again :composer require friendsofsymfony/rest-bundle
————————————————
first, create a database after make entities/models
***
php bin/console doctrine:database:create
when create or update anything in the database then first make and then run the migration
***
php bin/console make:migration

to run this newly created migration and each time while updating anything
****
php bin/console doctrine:migrations:migrate

—————————
php bin/console make:crud
(pre req is
composer require twig-bundle security-csrf
)
(and then enter BlogPost)
——————————
to see routes
php bin/console debug:router
——————————-
github project: https://github.com/ch-hassansaeed/sensor_monitor_api

Enjoy 🙂
OK Thats all
—————————————————————————————————–
thank you for watching
keep subscribe our channel h2zone
(https://www.youtube.com/c/H2ZONE_SP?sub_confirmation=1)
and don’t forget to press on bell icon to get all upcoming videos of our h2zone channel related to computer and technology tricks and solutions
#window #android #iphone #c #games #photoshop #php #python #wordpress #internet #tricks #art #symfony

Summary

How to create php symfony 5 Restful microservice CURD api and create MySQL database using doctrine migration libaray and how PHP Unit Testing works