Category: Patterns and Practices

How Laravel Facades Work and How to Use Them Elsewhere

The Facade pattern is a software design pattern which is often used in object oriented programming. A facade is, in fact, a class wrapping a complex library to provide a simpler and more readable interface to it. The Facade pattern can also be used to provide a unified and well-designed API to a group of complex and po...

Managing Cronjobs with Laravel

There are times when your application needs to run administrative tasks periodically on the server. Whether you want to send out emails to your users or clean up the database tables at the end of the day, you will need a task scheduling mechanism to take care of the tasks, when it’s time. Cron is a task scheduler sof...

Flyweight Design Pattern and Immutability: A Perfect Match

The flyweight pattern is a relatively unknown design pattern in PHP. The fundamental principle behind the flyweight pattern is that memory can be saved by remembering objects after they have been created. Then, if the same objects need to be used again, resources do not have to be wasted recreating them. You can think...

Can PuliPHP Re-Revolutionize PHP Package Development?

Puli is a new toolkit built on top of Composer that helps to manage and exchange resources like configuration files, images, CSS files, translation catalogs, and others. These are, you’ll agree, often difficult to maintain and share across projects. Puli provides a framework-agnostic solution to this problem, keepin...

Build a Superfast PHP Server in Minutes with Icicle

Event-based programming is a strange topic for PHP developers. In a language as procedural; events are little more than function calls. Nothing happens between events, and all meaningful code is still blocking. Languages like JavaScript show us what PHP could be like if event loops were at the center. Some folks have t...

An Introduction into Event Loops in PHP

PHP developers are always waiting for something. Sometimes we’re waiting for requests to remote services. Sometimes we’re waiting for databases to return rows from a complex query. Wouldn’t it be great if we could do other things during all that waiting? If you’ve written some JS, you’re probably familiar wit...

From Request to Response: A Journey into Drupal 8 Internals

In the first article on Drupal 8 module development we looked a bit at the routing aspect of this process. We’ve seen that creating pages with paths is now a matter of declaring routes that match up with controllers. The latter, as we’ve seen, can return a render array that gets interpreted into markup and displaye...

BDD in Laravel: Getting Started with Behat and PhpSpec

Getting Started with BDD in Laravel Introduction BDD is a complicated subject for many developers, and getting started with it the right way often does not come easy – especially when needing to implement it into existing frameworks. This tutorial aims to help you get a BDD-powered Laravel project up and running ...