How to Setup Docker for Your Symfony Project

As you probably know, I am a big Symfony fan 🙂 In the last few years I used Vagrant to set up my Symfony development environment more or less as described here. But we now have Docker and it’s time to move forward with a new setup. Docker containers are generally more lightweight than Vagrant virtual …

In Blog, PHP and Symfony

by Dragos Holban on September 18, 2017


How to Get Nearby Locations from MySQL Database

If you have a MySQL table with locations (latitude and longitude columns) you can get a list of locations near a specific point using the following query:

In this query we have noted the latitude of the reference point with <latitude>, its longitude with <longitude> and the maximum distance to search for with <distance> …

In PHP and Symfony

by Dragos Holban on September 14, 2017


Symfony OAuth Authentication for Your Mobile Application

Let’s say you built an API using Symfony and you need to access it from a mobile application using authenticated requests on behalf of your users. Here’s how to make this work using Symfony 2.8 and Doctrine. Install FOSOAuthServerBundle We will use the FOSOAuthServerBundle to implement this feature. Install it using the following command:

In Mobile Development, PHP and Symfony

by Dragos Holban on September 6, 2017


Face Detection with Apple’s iOS 11 Vision Framework

Great stuff is coming from Apple this autumn! Among a lot of new APIs there is the Vision Framework which helps with detection of faces, face features, object tracking and others. In this post we will take a look at how can one put the face detection to work. We will make a simple application …


Introduction to React Native

React Native is a framework for building native apps using React made by Facebook. With React Native, you don’t build a “mobile web app”, an “HTML5 app”, or a “hybrid app”. You build a real mobile app that’s indistinguishable from an app built using Objective-C or Java. React Native uses the same fundamental UI building …


Setup Docker Machine for Symfony Development

If you need a development environment for Symfony, hosted by Docker, you can use the fazy/apache-symfony docker image to start with, then extend it to your need. In your Symfony project’s folder add the Dockerfile and docker-compose.yml files. In the first one, we added mysql and composer, then we used the docker-compose.yml file to mount a …

In Blog, Development, PHP and Symfony

by Dragos Holban on April 27, 2017


How to monitor Symfony and Apache logs with M/Monit

So you have developed and deployed a fresh new project and you want to be alerted in case an error happens. Here’s how you do it using the M/Monit tool. It can be installed on an Ubuntu machine using the following command:

Now edit the /etc/monit/monitrc configuration file and add the following:

First we need to tell …

In PHP and Symfony

by Dragos Holban on January 12, 2016

1 comment

Symfony2 Doctrine Migrations with Unique Indexes (Slugs)

This is something me and my colleagues encounter from time to time. The Problem One of the problems of adding unique indexes to existing data, like adding the sluggable Doctrine behaviour using the StofDoctrineExtensionsBundle, is that the generated migration will end up throwing an error: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'UNIQ_BDAFD8C8989D9B62' Causes Since the default values for the new MySQL column …

In Blog, Development, PHP and Symfony

by Dragos Holban on October 27, 2015