Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Asmir Mustafic:
How do I deploy my Symfony API - Part 4 - Deploy
Oct 11, 2017 @ 10:23:12

Asmir Mustafic has posted the next part of his series covering the deployment of Symfony applications. In this latest article (part four) he focuses on some of the final steps of the deployment process.

This is the forth post from a series of posts that will describe the whole deploy process from development to production. The first article is available here, the second here and the third here.

After covering the steps 1-3 and having prepared our infrastructure, we can see how to deploy our application to production. Almost the same approach can be used to deploy not only to production but also to test environments.

He starts with the workflow for the deployment process, creating a flow where the "git push" should trigger other actions based on the branch pushed. Then CircleCI will fire off a series of jobs to handle environment setup tasks, connecting to a VPN and deploying the code. This includes a bit of preparation, credential handling and the Docker setup and push. Each step along the way also includes all of the YAML configurations you might need to replicate the deployment.

tagged: symfony api deployment part4 series docker configuration example

Link: https://www.goetas.com/blog/how-do-i-deploy-my-symfony-api-part-4-deploy/

Armin Weihbold:
Diving into API Platform - Part 2
Oct 02, 2017 @ 11:50:15

Armin Weihbold has continued his series looking at building APIs in PHP applications in part two covering the use of the API Platform project as a base. You can find part one here if you need to get caught up.

He picks up right where the last article ends and continues setting up the Docker environment for the application. Once he figured out a small snag in the setup he was able to get the basic documentation (the list of endpoints) up and running.

Next he creates a "material design" administration interface using React showing how he pulled in the requirements he needed to get the interface up and running. Code is included for the interface and a screenshot is included so you can see the end result.

tagged: api platform apiplatform project tutorial series part2 frontend docker

Link: https://medium.com/@koyaan5/diving-into-api-platform-part-2-1ce890c0b85f

BitPress Blog:
My Simple Approach to using Docker and PHP
Sep 20, 2017 @ 11:55:39

Paul Redmond has written up a tutorial sharing his simple approach to using Docker and PHP to provide a more robust development environment.

Getting started with Docker and PHP can still be a steep learning curve. You might feel that you don’t need something like Docker and that Vagrant or full local development work just fine. I still use local development on some projects because the barrier to entry is small.

You will likely face scenarios where you require different versions of PHP, work with multiple developers, and seek consistency between environments. When you’re working with a team, you need a consistent way to develop. I’ve been on teams where different versions of PHP and MySQL varied between developers. I want to show you how Docker can fill the gap of providing consistent development environments, and do so without a huge amount of added complexity.

He starts with some background on why he decided to learn how to use Docker for his PHP development and how it has helped simplify his setup. He then walks you through some of his initial steps with Docker, providing the commands to create a new Laravel project and the structure he uses for his projects and the base image. He covers the contents of the Dockerfile, the Apache VirtualHost setup and how to build out the image. The post also includes instructions for:

  • running Apache
  • running "docker compose"
  • adding a volume for local development
  • adding MySQL
  • running commands
  • how to connect to the MySQL instance running in the container

Each item on the list includes configuration changes and commands that you'll need to get everything set up and running in a simple Docker container on your system.

tagged: tutorial docker setup configuration environment introduction

Link: https://bitpress.io/simple-approach-using-docker-with-php/

Dragos Holban:
How to Setup Docker for Your Symfony Project
Sep 18, 2017 @ 11:48:31

In a tutorial posted to his Medium.com site Dragos Holban continues his series walking you through Symfony for PHP applications. In this latest part of the series he shows you how to use Docker to set up an environment for a Symfony-based application.

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 machines, so starting and stopping them is extremely fast. They also take a lot less disk space.

He starts by sharing an example Dockerfile and docker-compose.yml to help set up and configure the environment to be ready for use. The configuration sets up Apache, PHP 7, MySQL, git, Composer and several PHP extensions. It then installs a fresh instance of Symfony and runs a bash file to finish the setup. He shares the contents of this file and the VirtualHost configuration for the web server. Finally he shows how to run the setup via the Docker command line tool and what you can expect to see when things are running smoothly.

tagged: docker symfony setup configure dockerfile compose tutorial series

Link: https://medium.com/@dragosholban/how-to-setup-docker-for-your-symfony-project-ff9b1bf44e68

James Wade:
PHP CI with Jenkins and Docker (Part 1)
Sep 11, 2017 @ 09:06:28

On his site James Wade has posted the first part of a tutorial showing you how to get your PHP application set up for continuous integration with Jenkins and Docker. In this part of the series he focuses on the setup of the technology involved, linking to every tool you'll need.

I’ve been developing in PHP now for longer than I haven’t. Going from using PHP as a hammer to a nail, using it to allow forms to send emails, to operating popular open source projects, to leading a team of developers in a business enterprise. One key advice I learned from running an open source project on the SourceForge platform was “release early, release often”.

This is a mantra that I’ve always tried to stick to and its always brought me good results. As I get into more and more complex projects, both in code structure and politically, I find myself turning to tools to solve problems. One of those tools is Continuous Integration.

He talks about coding styles and IDE automation that can help make you code better and cleaner but points out that there's more to be done than just that. He briefly covers the idea behind continuous integration and why he chose Jenkins for his environment. He then gets into the setup process, showing how to get tools like PHPUnit, phploc, phpmd and phpcpd installed. He includes the dockerfile to set up this environment and the bash script that handles the setup process. He finishes the post with a brief look at the automation that happens thanks to the Jenkinsfile configuration and what's coming in part two of the series.

tagged: continuous integration jenkins docker series part1 tutorial

Link: http://wade.be/development/2017/09/03/php-ci.html

PHP Roundtable:
066: Docker: Drinking the Kool-Aid
Aug 31, 2017 @ 10:53:25

The PHP Roundtable podcast, hosted by Sammy K Powers, has posted their latest episode with guests Phillip Shipley, Chris Fidao and Chris Tankersley (author of Docker for Developers): Episode #66 - Docker: Drinking the Kool-Aid.

After years of resisting, SammyK finally drank the Docker Kool-Aid for his everyday client work. We talk about his transition from Vagrant to Docker and some bumps he hit along the way.

You can catch this latest episode either using the in-page audio or video players, by watching directly on YouTube or by downloading the audio for listening offline. If you enjoy the show and want to see more like it in the future, be sure to subscribe to their feed and follow them on Twitter for updates when new shows are released.

tagged: phproundtable podcast video docker koolaid phillipshipley chrisfidao christankersley

Link: https://www.phproundtable.com/episode/my-transition-from-vagrant-to-docker

Delicious Brains Blog:
Behind-the-Scenes: How We’re Automating Acceptance Testing
Aug 15, 2017 @ 10:57:04

On the Delicious Brains site Ian has written up a lengthy post sharing how they automate their acceptance testing for their PHP applications.

Have you ever had the joy of carrying out acceptance tests? For our team at Delicious Brains, testing our releases, in the past, has been one of the most dreaded tasks on the to-do list. We hold our plugins to a high quality standard so it’s a must but manual tests are brain-numbingly tedious and can take hours of expensive developer time.

Recently, we decided it was high-time to fix that. [...] Read on for more about how the automation of testing our plugins ahead of release is shaping up – including how we manually tested in the past and a look at some of the automated acceptance tests we’ve already implemented.

He starts by defining what acceptance testing is and how they're different from other types of testing. He then shows the manual method they were using to run their tests previously and what prompted the move towards automation. He talks about the tools that they use for their automated testing including Codeception and Docker. Configurations and scripts are included that make the automation work and some of the issues they came across during the move from manual to automated processes.

tagged: automated testing codeception docker tutorial setup configuration manual

Link: https://deliciousbrains.com/how-were-automating-acceptance-testing/

Kevin Schroeder:
Magento 2 Performance on Docker (a preliminary test)
Aug 14, 2017 @ 09:58:17

Kevin Schroeder has a post to his site sharing some of the results from his initial testing with Magento in a Docker-built environment.

I can’t speak to the cost of Docker experts (I’m not one, but my experience is that once you get through the annoyance of the Dockerfile it doesn’t require much more advanced knowledge than a regular sysadmin), but I found the response interesting because my experience with Docker in production has been so good that I’ve Dockerized practically everything, including this blog. But this guy knows his stuff, and I give a lot of weight to his perspective. But my experience has been different.

Except in one place. Magento 2 on Docker on Mac is a horrible experience and it is specifically because of file system performance. But on Linux I’ve had good experiences. However, those experiences were with Magento 1 and not Magento 2. Magento 2 relies on the file system more than Magento 1 so it is quite plausible that Magento 2 is slow as molasses on Docker.

He decided that he'd try a different platform and see if the results were similar to those on an OSX system. He includes a list of four caveats and the setup including the fact that it is a "smoke test" (prelimary results) and that the rest was being done on a bit older machine. He shares the testing setup and what he used to test and compares the results to it running on "bare metal" (a normal custom setup server). His findings show that the "bare metal" instance ran only slightly better than the Dockerized version. He includes graphs for the requests handled, CPU usage and throughput from each of the tests executed.

tagged: magento docker performance testing results

Link: http://www.eschrade.com/page/magento-2-performance-on-docker

Jakub Zalas:
Static analysis tools for PHP in a single docker image
Jul 21, 2017 @ 10:56:07

Jakub Zalas has a new post to his site sharing a Docker image he's created to help make static analysis for your PHP code simpler: the phpqa image.

As part of my job I often perform application reviews and code quality analysis for clients who wish to have their code base looked at by an independent company. Running static analysis tools is usually a starting point to the review as it gives a general overview of a state of the project. I also like to run those tools as part of an introduction to an inherited code base.

For an easy access to the most popular static analysis tools for PHP I recently created a docker image - phpqa.

He lists out the tools that are included with the current version (a quite lengthy list) including:

  • analyze
  • box
  • deptrac
  • php-code-fixer
  • phpDocumentor
  • phpa
  • phploc
  • phpmd
  • phpstan
  • psalm

...and many more. Check out the full post for more of the tools in the list and links to more information about each one.

tagged: docker image static analysis tool image phpqa

Link: http://zalas.eu/phpqa-static-analysis-tools-for-php-docker-image/

Colin O'Dell:
Testing PHP 7.2 With Docker
Jul 07, 2017 @ 11:58:07

Colin O'Dell has posted a guide that you can follow to help you test your applications with the latest version of the PHP 7.2 pre-releases using a simple Docker setup.

PHP 7.2 is slated for release in November 2017, but you don't have to wait until then to start testing your applications! We can easily use Docker to test against the latest pre-release versions of 7.2.

He's even created a Docker image that's posted on DockerHub to make the process even simpler. He shows how to reference specific types (php-fpm, apache, etc) and specific tags for the PHP pre-releases on each. He encourages you to log bugs in the PHP if found and report issues to him if there's a problem with the Docker setup. He also mentions that, since the mcrypt extension was removed by default from PHP 7.2, you'll need some special commands to get it set up and working (via a PECL install).

tagged: testing php72 prerelease version docker image dockerhub

Link: https://www.colinodell.com/blog/201707/testing-php-72-docker