Debian 8 - Install GPG Extension for PHP 5.6

Below is a script you can run to install the GPG extension for the PHP 5.6 CLI and Apache on Debian 8. It may work on other distributions and versions of PHP, but I have not tested that. The script assumes you already have Php 5.6 and Apache…

Read this article

Debian 8 - Install PHP 7.1

Using Ondrej Sury The easiest way to install PHP 7.1 is to execute the following command. curl -s https://scripts.programster.org/scripts/23?output=raw | bash cURL with BASH disclaimer. Alternatively, you can copy and paste the following script, which is what the previous command downloads and executes.…

Read this article

Dependency Injection

Anthony Ferrara has a brilliantly simple youtube video explaining dependency injection that I highly recommend. In basic terms, anywhere that you pass an object into another Class's constructor, rather than creating a new instance of that object within the constructor, you are using dependency injection. Dependency injection allows for high…

Read this article

Slim3 - Use Middleware to Check User Is Logged In

One of the most common tasks I have to perform in developing web applications is check that the user is logged in and redirect them to the login page if they are not. Also, there are certain routes, such as /login, and /register that should not incur a redirect because…

Read this article

Debian 8 - Setting up PHP For Aerospike

This tutorial will show you what you need to need to do in order to start interfacing with an Aerospike database with PHP scripts. If you haven't done so already, install PHP and composer. sudo apt-get install php5-cli # Install composer curl -s https://scripts.programster.org/scripts/21?output=raw…

Read this article

Getting Started With Using PostgreSQL in PHP

The first thing you need to do is install PHP and support for PostgreSQL. For ubuntu 16.04 you would need to run: sudo apt-get install php7.0 php7.0-pgsql -y If you haven't already installed a PostgreSQL server and configured it with a password and to allow remote connections,…

Read this article

RabbitMQ Exchanges With PHP

This tutorial will show you how to setup RabbitMQ in terms of an exchange, rather than for a queu as demonstrated below: The source code for this tutorial can be downloaded from Github. Related Posts RabbitMQ Job Queue With PHP Deploying RabbitMQ With Docker What is An Exchange? An exchange…

Read this article

RabbitMQ Job Queue With PHP

This tutorial will show you how to deploy and utilize a job queue in PHP using the RabbitMQ server we deployed through Docker. Why Use Job Queues? Job queues allows your infrastructure to gracefully cope with massive fluctuations in demand without having to scale up/down rapidly. For example, if…

Read this article

PHP - Install YAML Support

If you need to generate YAML files from PHP (perhaps for Docker Compose), then it is probably easiest to install the YAML Data Serialization PECL package. Thist tutorial will show you how to do that on Ubuntu 14.04. Installation Run the following bash script: sudo apt-get install php5-dev php-pear…

Read this article

PHP Gotchas and Tips

Here are some PHP observations that I have been caught out with and am posting so I don't get caught again. This post will grow over time as I find more bite-size nuggets. Gotcha: Array Merge Guess what the output to this code will be: <?php $lookup_table = array(…

Read this article