Shiphp The PHP Developer's Guide to Docker

Latest Blog Posts

Array Functions in PHP

Arrays are an important and widely used type in PHP. They are essentially ordered maps that allow developers quick access to key-value storage in their applications. For some basic array examples, see my previous post of working with arrays in PHP. PHP has over 75 array functions to help you manipulate and use arrays more efficiently. Since t... Read more

Running a Laravel Application in Docker

My favorite PHP framework for the past few years has been Laravel. It combines modern best practices with developer-friendly tools and pretty much all the common components that web developers need. There are already several good ways to set up a local development environment for Laravel including Homestead and Valet, but if you’re interested... Read more

Deploying a Docker-Based PHP Project with Hyper.sh

Once you’ve built a local PHP application using Docker, you have many options for hosting. One of my favorite tools is Hyper.sh, a container-based hosting platform that works for just about any Dockerized project you have including PHP projects. Hyper.sh charges you only for uptime on your containers, so it’s a perfect solution for continuous ... Read more

Try/Catch Blocks in PHP

When things go wrong within your program it’s a good idea to handle the failure gracefully in some way. One of the best ways to deal with exceptions is by using a try...catch block. Let’s take a look at how this works. The Basics First let’s look at the success case — in other words when an exception is not thrown: <?php try { echo "... Read more

Using Docker to Run a PHP and MySQL Application

One of the most common operations for any application is to connect to a database, but installing multiple databases locally can be a tricky process. You have to make sure everyone on your team has the right version and that they’re connecting the same way. Fortunately, Docker makes this really simple and more transferrable. 1. Write a PHP Sc... Read more