Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Creating a Symfony Ecommerce App

19 views

Published on

Symfony can be used to create an ecommerce app. You can also easily integrate ReactJS on the front-end of your Symfony ecommerce app and use Cloudinary for storing images.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Creating a Symfony Ecommerce App

  1. 1. Create an Ecommerce App in Symfony Using React and Cloudinary
  2. 2. End Result
  3. 3. Prequisites • Knowledge of React, OOP with PHP, and MVC Web API Patterns • Cloudinary Account • Node.js • Yarn Package Manager • Symfony Installed and Optimized on the server/localhost
  4. 4. 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 controller • 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 data.
  5. 5. 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 created later. • Inside index(), add a constructor method and the mentioned private properties.
  6. 6. 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.
  7. 7. 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.
  8. 8. • Read the full article on Creating Symfony Ecommerce app with Cloudinary and React.

×