PHPUnit tests with Peek and Poke - No more Reflection

Sometimes you want to test your protected or private methods or need access to a class property. This can be achieved via the PHP ReflectionClass, but it's some lines of code. Sebastian Bergmann has created a new library Peek and Poke, which does the job. See this tutorial how to use it. Some people would argue that only public methods should be tested. That's right, » ...

Autoloading Grunt tasks concurrently with optimized assets

Currently, I have more to deal with front-end stuff, because of creating a responsive web layout for a popular shop. We use a Grunt build process and the template engine Handlebarsjs to create a style guide and the several pages. On Linux is the build performance ok, but on Windows it's slow. In this post I will share my experience how making the build process » ...

Hexagonal Architecture, Domain Driven Design, Event Sourcing, Oh, My!

In the past weeks I've read something about Domain Driven Design and Hexagonal Architecture. And the more I've read, the more I know that I know nothing. In the end I ended up with Event Sourcing and of course, don't forget Command Query Responsibility Segragation. In this article I will give an overview of these techniques. There are also a few links, books and GitHub » ...

Build a Selenium-Grid in minutes with Docker

To parallelize integration tests with Selenium you will need a Selenium-Grid. This is quite easy with Docker and Docker Compose (the new fig). It is also possible to build your own Docker container with different Firefox or Google Chrome versions and you can register your Windows or Mac computer with it's browsers to the Selenium-Hub. With a VNC client you can view the testing process, » ...

Logrotate for Docker container

It's a best practice to log the Docker container output to /dev/stdout and /dev/stderr. But you should not forget to enable a Logrotate for your Docker container log files. The Docker container log file is saved in /var/lib/docker/containers/[CONTAINER ID]/[CONTAINER_ID]-json.log. You can use another service like fluentd or the ELK (Elasticsearch, Logstash, Kibana) stack but this » ...

PHP Profiler - Z-Ray, Blackfire, Tideways

Last year was the year of PHP profiling tools. Companies like Qafoo, Zend and SensioLabs have released its own profiling tools. Bottlenecks or inefficient code is a thing of the past. All PHP profiling tools are awesome and have its own advantages. This is a quick overview, so you have a good starting point to choose your PHP profiling tool which fits your needs. At » ...

Doctrine 2 plugin for Zend Server Z-Ray

There are some awesome Zend Server Z-Ray plugins, but there was none for Doctrine 2. I like the Doctrine 2 Zend Developer Tools extension, but with Z-Ray there are so many possibilities to display Doctrine 2 information. And the best part is, it's so easy to develop. Simply trace the function you want and collect the desired data. The Doctrine 2 plugin for Zend Server » ...

Remote PHPUnit code coverage in PHPStorm

There is a great PHPUnit code coverage plugin for PHPStorm. After installing this plugin your code coverage will be displayed directly in PHPStorm. Do you know how to use it remotely e.g. mit Vagrant? No, then this article is for you. Install PHPUnit code coverage plugin To install the PHPUnit code coverage plugin please open the menu File -> Settings -> Plugins and search » ...

Vagrant remote PHP & CLI debugging with PHPStorm

First we will cover how to enable PHP remote debugging in PHPStorm if Vagrant is used and because this is so easy we also write a short Shell script to use remote PHP CLI debugging e. g. for Cronjob scripts or unit tests. If you don't have a Vagrant box you can use my vagrant-librarian-puppet example. If you use this Vagrant box you can skip » ...

Configuring nginx to speed up Ghost blog powered by Docker

I was searching for some nginx configurations and found a blog post to speed up a Ghost blog. Unfortunately it doesn't work out of the box. However it was very interesting to set up nginx as a reverse proxy and cache for my Node.js Ghost blog powered by Docker. nginx configuration The nginx configuration is more complex. I want to serve static content directly » ...

Ghost theme Casperion

Why another Ghost theme? Well, there was no up2date free Ghost theme available which was based upon original Ghost theme Casper and with the following features. Full text search Disqus comments Highlight.js integration Google Analytics Top pinned navigation bar and off-canvas menu Social font icons Minified css and js Additional meta tags On the other site I want to use SASS and Gulp to » ...

15 hints for high quality PHP projects

This is a short list of PHP hints to avoid common mistakes which I've seen through the years. Others have the same problems and probably already a solution. Remember every own code line in your project costs money and must be maintained. With the following 15 hints can you incredible improve your project quality! Use E_ALL | E_STRICT as PHP error_reporting and display » ...

Hello world powered by Docker and Ghost

I'm proud to announce my first blog post which is brought to you by Docker and Ghost. If you are not familiar with Docker, i highly encourage you to have a closer look at this great technology and the ecosystem around Docker. You only need two steps to run this on your server. First you have to install Docker on your server or local. For » ...