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

Configure Doctrine Multiple target entities

Many developers are often plagued with questions of the best possible way to handle inheritance mapping or configuring multiple target entities in doctrine. How does one do that? Lets go over a slightly different scenario first to understand the real problem better. Lets say you have 2 entities with their respective fields: Person (id, name, profession) Engineer (id, level) We want that Person could have a profession of an Engineer. …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

File permissions mode 0777 vs 777

If the question Whats the difference between 0777 vs 777 file modes? runs through your mind, you’re not alone. Lets find out… A bit of history, I needed to create a directory (using Php). So as per the syntax of mkdir(), I used mkdir(‘/path/to/create/dir’, 777); where the 2nd passed parameter is the file mode. Normally, this should have worked fine and uploading any file to this folder should have worked …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