Setting up Laravel with Docker Compose

When you work on multiple projects and run these locally through, for example, Apache this means you have to maintain and tweak your local server environment all the time. Additionally, when you work on that same project with multiple people, chances are your co-workers have a slightly different setup. These slight changes in set-up can be harmless, but more times than not, cause for developer headache or unwanted code-alterations to make it work.

Loading external files in PHP the better way

Sometimes you run into “weird behavior” when using file_get_contents in your code when retrieving external data. I noticed this for instance when accessing the Facebook Graph API the other day. When using file_get_contents the results were so much different than when using cUrl. Sometimes even, it is disabled on your host for security reasons. So i’m making it a habbit to run everything through cUrl instead. Not just to get the “actual results”, but also since it’s a lot faster.

Installing PHPUnit manually for CakePHP 2.0

I was trying to get into Unit Testing a few months ago. It was a steep learning curve and eventually I gave myself a non-excuse and decided to wait for Cake 2.0 as that would have PHPUnit and it “wouldn’t make sense to learn SimpleTest” at that time. I intend to keep that promise and have been trying to get into Unit Testing for real this time. The first thing was also the most annoying so far: installing the (&#(&.

Use GZip with PHP

I recently started using GZip headers in my websites and the results are simply amazing. Right up there with coffee, sneezing polar bears and green traffic lights. Nowadays, files are big. People used to optimize graphics and CSS stylesheets. This day and age we just don’t care anymore. At the same time bandwidth is getting more expensive and the mobile market is growing bigger. Not a good combination. Enter GZip Adding GZip to your applications couldn’t be simpler, and using this compression to your output can reduce the amount of data being sent by around 70-80% for your average stylesheets.

Using LESS in CakePHP

I was a bit bored this morning with my previous Less component, so decided to rewrite the thing and added some new features such as caching. It’s pretty straightforward and simple to set up. If you can’t wait, the code is available here. For more information, read on. This little helper converts your .less files into .css without relying on Node.js Installation Clone Clone from github: in your plugin directory type:

Using Markdown in CakePHP

Markdown rocks. I lately fell in love with it when I was setting up this very blog. You can just write easy-to-read and easy-to-write plain text files, and Markdown takes care of the rest. For this blog I had used a Markdown script I found that parses plain text and outputs it as HTML. It allows me to write posts in a simple/plain format and just pump it into the database as is.

How to handle multiple domains with CakePHP

Lately, we’ve been working with multiple environments/servers for our websites to be able to have them approved by clients before going live. However, following set up can also work nicely when you develop your sites locally and don’t want to keep changing the configuration every time you upload it. Setting up the database config file So, what changes in your config? Not all that much. Let’s have a look at the default database.

Setting up CakePHP with MAMP Pro on Mac OSX

I’d like to use my first post to describe how I set up new projects in a simple way that works best for me. My setup is pretty straight-forward, really. I know some people who mess about with include-paths so they can run multiple apps on one cake-install, but since I work for various clients and even more various projects I like my project folders to be self-contained. Downloading CakePHP Easy enough.