• Knowledge of React, OOP with PHP, and MVC Web API Patterns
• Cloudinary Account
• Yarn Package Manager
• Symfony Installed and Optimized on the server/localhost
Create Products in Symfony
• Create Symfony API manually by generating doctrine entity
• Generate and configure product entity
• Create and Configure Product Controller. Add index() method in the
• Create new product endpoints by adding a function inside index() method.
Here you are creating products.
• You will be using two custom functions in the code:
uploadImageToCloudinary() and updateDatabase()
• First one uploads image to Cloudinary and second one will persist and flush
List All Products
• Create a function to fetch and list all the products.
• The function will return a JSON response to list the products.
• The JSON response will be looped through React so it is displayed correctly
to the users.
• This will be done in Product Controller created earlier.
• Inside the Product Controller, there is ProductRepository which will be
• Inside index(), add a constructor method and the mentioned private
Adding Favorite Count to the Product
• For this, a Favorite button will be added to the front-end.
• To record the number for favorites received, we will create API.
• For this, a method will be added to ProductController.
Setting Up and Configuring Cloudinary
• Login to your Cloudinary Dashboard and note down your Cloud name,
API Key and API Secret.
• Use PHP-SDK provided by Cloudinary to create upload service.
• Install Cloudinary and create a folder name Service inside src folder.
• Create file named imageUploader.php under the folder.
• In this file, define a PHP class for image uploading on Cloudinary.
• Open .env file and update your Cloudinary credentials in it.
• Read the full article on Creating Symfony Ecommerce app with
Cloudinary and React.