testing and fixtures

Setup Testing and Fixtures in Symfony2: The Easy Way

1 Comment
Setting up testing and fixtures in Symfony2 is vital if you plan on starting Test Driven Development or you simply want to start covering your code with properly written tests that can access mock data.   1. Install PHPUnit and php 5.6 The first thing you need to do is...

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...

send emails in symfony2

Send Emails in Symfony2: The Right Way

No matter what your app is about, at one you point you will have to send emails in Symfony2. Even though this process might seem straightforward and easy to apply, it can actually get pretty tricky. Here’s how you can send emails in Symfony2 by properly splitting your functionality...

Symfony2 Facebook and Google Login: The Easy Way

Since pretty much any potential user of an app has a Facebook or a Google account, it’s crucial to have a login or registration service using these social networks. Luckily, HWIOAuthBundle provides the necessary tools to accomplish this. So here’s an easy and straightforward way to integrate HWIOAuth in our app alongside...

APIs in Symfony2

Getting Started with Building APIs in Symfony2

Hello all you Interwebs friends! While we’re passing through the shallow mists of time, REST is becoming more and more of a universal standard when building web applications. That said, here’s a very brief tutorial on how to get started with building APIs in Symfony2. Spoiler alert: the bits of code written...

Symfony2 Doctrine Migrations with Unique Indexes (Slugs)

1 Comment
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: Causes Since the default...

How to Create a Custom Symfony2 Password Encoder

As you advance through your Symfony2 developer life, you will probably encounter the need to create a custom password encoder for you Symfony2 project. One of the most common reasons to do this, is when you migrate from an old project (different technology) and you have to keep users...

How to Fix Symfony2 Ajax Login Redirect

You probably noticed that sometimes an Ajax request will return the login page instead of the actual content is should return. This happens when the user has beed logged out in the background and the current page does not reflect that (it could happen if the session expired or if...

How to Enable Email Confirmation on FOSUserBundle Profile Edit

We all know and use FOSUserBundle in our Symfony applications, so much it became kind of a standard. It provides everything you need for user management: login, registration, email confirmation and much more control over the access of the user in your application. But we found a thing missing from this...

How to Store Latitude and Longitude in MySQL

1 Comment
As we know, a latitude value can be between -90 and +90 degrees, whereas a longitude value can be between -180 and +180 degrees. To get accuracy to within a meter, only six decimal places are needed, which is sufficient for most cases. But you can go even further by...

© 2017 IntelligentBee. Crafted with love.