File Upload with API Platform and Symfony

In this guide, we will walk you through the steps of how to handle file uploads with API platform and Symfony. The official documentation on file uploads seems a bit convoluted to me and hence this article hopes to make it easy (in layman’s terms)! To many, handling File upload may seem tricky, but is really not difficult at all. If you are new to the API platform, it is …read more

Building a REST API with Symfony and API platform

One of the basic building blocks of a project is to have a nice resilient API. In this guide, we will show you how you could setup a fully functional REST API with Symfony and API platform which conforms to the Open API specification. As a bonus, you will also get auto-generated documentation via Swagger. Lets jump to see what exactly we need to get started… Rest API with Symfony …read more

JWT Authentication with Symfony

Configuring JWT Authentication with Symfony can be quite tricky, especially for beginners. We’ll guide you through a step-by-step tutorial getting you up to speed. We use LexikJWTAuthenticationBundle to setup JWT Auth in less than 10 mins. Our setup for JWT Authentication with Symfony Symfony 3.x, 4.x, 5.x FosUserBundle (you may use any other user provider as well) LexikJWTAuthenticationBundle (used to setup JWT authentication) If you are very new to JWT(JSON …read more

Create Custom Twig Filter in under 2 min

A custom twig filter is required when the available twig filters cannot do the job for you. Base64 encoding and decoding for example, cannot be done using the built-in filters even though these functions exist in pure PHP. So how do you create a custom twig filter in Symfony? Requirements: Symfony 3.4 and above Create Custom Twig Filter For the sake of an example, we will be creating 2 filters …read more

Routing with Symfony and Vuejs Router

One of the initial problems you might come across while integrating Symfony and VueJs is probably Routes. How do you handle this Symfony Vuejs routing? How to let Symfony forward the request to Vue Router? Lets quickly get to answering these questions. Forwarding Requests from Symfony to the Vue Router To allow the Vue Router to take control, we need to forward incoming requests from Symfony to the Vue Router. …read more

Support ES2017, ES2018 features in Webpack encore

Want to start using async generator function, spread operator and all the latest features of ES2017, ES2018 in your projects? Well, wait no further to checkout how easily you could achieve this! There are 2 ways of supporting these features – Update .babelrc file Update Webpack Encore config A little background explaining What is Babel? And what are Babel presets? Latest features of Javascript (like spread operators) may not supported by …read more

Symfony Vue JS Integration in under 10 mins

Integrating a good front end library like Vue js has become a de facto standard these days. This tutorial aims at integrating Vue js with Symfony backend. Symfony Vue Js integration is one of the best combinations for a trendy App, whether it be a SPA or a traditional Web App. Requirements Symfony 3.4 and above Vue JS  2.5 and above FOSRestBundle (optional, but useful when you want to develop …read more

Generate Sitemap in Symfony in 2 simple steps

What is a Sitemap? A Sitemap is a XML file that contains a list of URLs on your website that help the Search Engines discover and crawl your website more effectively. Generating a Sitemap in Symfony is one of the trivial tasks one might encounter. There are a few bundles that might help you, although the process & configuration could be tricky, especially for beginners. This tutorial aims at generating …read more

JS File Upload with Dropzone and Symfony

Handling File Uploads completely server-side (especially with Symfony) doesn’t usually seem a pretty straightforward task. It requires a lot of tweaking for stuff as simple as displaying the upload progress or even generate thumbnails for images, etc. Besides, the documentation is pretty convoluted in itself. An alternate is to use the simplicity of JS File Upload with Dropzone and Symfony 3.x+ that’ll not only help fast-track development but also avoid …read more

Get Random rows in Doctrine

Every Php Symfony developer knows the struggle of getting random rows/records via Doctrine. This is because there is no native solution present and quite unfortunately, the doctrine team isn’t even willing to implement this feature! (Reference) So how could we get random rows/objects? Lets go over the possible options, each having its advantages & disadvantages : 1. Add a customized Numeric Function: To do this, define a new class in …read more