Overview
how to create php symfony5 curd microservice api Demo sensor project using symfony5 ,Restful Api , mysql and phpunit test
github project: https://github.com/ch-hassansaeed/sensor_monitor_api
this project is made using symfony5 ,curd microservice Restful Api , mysql and phpunit test.
————————————————
for the upcoming video we will discuss in detail that how we can download symfony 5 and make symfony 5 project after that we will discuss how we can make entity/model classes and make its table automatically using ORM doctrine package also we will discuss how we can make the relationship in symfony5 enity class using doctrine command
php bin/console make:entity
also we will discuss how we can make CURD controller for any entity using command and then we will discuss Restful API working in symfony
in the end of tutorial we will see how PHP unity testing works in symfony5
so keep subscribe for more videos
————————————————
API Testing
http://127.0.0.1:8000/admin/sensors
it will show the CURD form in which we can view,add,edit and remove sensors
Problem 1:- Reqeust: http://127.0.0.1:8000/api/v1/sensor/222-dfs-34-df2-234-fdsf-234/mesurements { "co2": 1178, "time": "2020-10-11 17:17:38" } Response: {"new measurement collected with id:":1} Problem 2:- Reqeust: http://127.0.0.1:8000/api/v1/sensor/222-dfs-34-df2-234-fdsf-234 Response: {"status":"OK"} OR {"status":"WARN"} OR {"status":"ALERT"} Problem 3:- Reqeust: http://127.0.0.1:8000/api/v1/sensor/222-dfs-34-df2-234-fdsf-234/metrics Response: {"maxLast30Days":2945,"avgLast30Days":2495} Problem 4:- Reqeust: http://127.0.0.1:8000/api/v1/sensor/222-dfs-34-df2-234-fdsf-234/alerts Response: [ {"startTime":"2020-10-14 17:17:38","endTime":"2020-10-18 18:18:38","mesurement1":"2871","mesurement2":"2671","mesurement3":"2371"}, {"startTime":"2020-12-04 18:18:38","endTime":"2020-12-05 18:18:38","mesurement1":"2945","mesurement2":"2745","mesurement3":"2345"} ]
symfony Supportive commands
start the symfony server symfony server:start
create database using php bin/console doctrine:database:create
create or make migration using php bin/console make:migration
run the migration using php bin/console doctrine:migrations:migrate
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 #programming #games #photoshop #php #python #wordpress #internet #tricks #art
Summary
how to create php symfony5 curd microservice api Demo sensor project using symfony5 ,Restful Api , mysql and phpunit test