PHPNews

First steps with Windows on Vagrant

One thing that would be useful for one of my projects is an easy way to install IIS, PHP & SQL Server on Windows in a repeatable way. I wasn't sure how to do this until I came across Chocolatey and Boxstarter . Chocolatey is a package manager for Windows along the same lines as yum and apt for Linux and knows …

Continue reading »

Written by Rob Allen - - Aggregated on Thursday November 14, 2019


Testing migrating to Laminas

Zend Framework is renaming to Laminas and all the source code is moving to a new GitHub organisation. Implicitly this means a new PHP top level namespace. As you can imagine, this implies that a lot of our code will need to change, so Matthew , Michał and the team have been writing migration tooling to make …

Continue reading »

Written by Rob Allen - - Aggregated on Wednesday November 6, 2019


Embedding Notist slides

This site uses WordPress under the hood as I find the flexibility that a good CMS provides quite useful. For the talks section, I use a custom post type so that I can set additional properties on the post and customise the display. With my usual lack of imagination, my custom post type is called talk . When …

Continue reading »

Written by Rob Allen - - Aggregated on Wednesday October 30, 2019


HTML encode selected text on Mac

When writing blog posts, I write directly in HTML, mostly from habit and because I've not set up mark-up text processing on WordPress. I'm comfortable enough with simple HTML that it's never seemed important enough to sort out, especially with MarsEdit 's macros for common HTML tags. One thing that I need to do …

Continue reading »

Written by Rob Allen - - Aggregated on Wednesday October 23, 2019


Custom error rendering in Slim 4

One of the nice things about Slim 4 is that it's easier to customise the HTML generated on error without having to worry about the rest of the error handling mechanism. This is because we have separated error rendering from error handling. Slim's default ErrorHandler maintains a list of renderers, one for each …

Continue reading »

Written by Rob Allen - - Aggregated on Wednesday October 16, 2019


Folder types in AppleScript

I've recently moved to Adobe Lightroom Classic for photo editing, but am still using Apple Photos for viewing my photos on my iPhone and iPad. As such, I wanted an easy way to import photos exported from Lightroom into Photos, so I turned to AppleScript. My requirements are that I want to import all the photos in …

Continue reading »

Written by Rob Allen - - Aggregated on Wednesday October 9, 2019


Dependency Injection in Slim 4

In contrast with Slim 2 and Slim 3, Slim 4 does not ship with a DI container, but instead, supports any PSR-11 compatibly DI container that you provide. This is part of Slim 4's commitment to interoperability via the PHP-FIG standards. The easiest way to add a container to your Slim application is to call …

Continue reading »

Written by Rob Allen - - Aggregated on Wednesday October 2, 2019


Running Slim 4 in a subdirectory

If you want to run Slim 4 in a subdirectory of your website, then you have a few things you need to do. Let's consider the situation: Your main website is in the directory /var/www/html and is accessed at https://example.com/ . You want your new Slim 4 app to be in the directory /var/www/html/myapp and to …

Continue reading »

Written by Rob Allen - - Aggregated on Thursday September 26, 2019


Slim4-empty: minimal Slim 4 starting point

To simplify creating a new Slim 4 project, I've created slim4-empty which does this for me. To use it: $ composer create-project akrabat/slim4-empty my-new-project and you're done! The my-new-project directory is created and contains Slim 4 along with a minimally viable public/index.php to get …

Continue reading »

Written by Rob Allen - - Aggregated on Wednesday September 11, 2019


Receiving input into a Slim 4 application

A Slim 4 (and Slim 3) application receives data from three places: Any query parameters on the URL (the key-value pairs after the ? ) The HTTP message's body (usually for POST and PUT) messages Parameters in the URL (such as the 3 in https://example.com/users/3 Within the application, these are …

Continue reading »

Written by Rob Allen - - Aggregated on Wednesday September 4, 2019


Automatically mounting a network drive on Mac

I have so many photos that I can't store them all on my hard drive and keep them on my NAS. While on my home network, it would be convenient to automatically mount the NAS folder onto my Mac as I keep forgetting before I open Lightroom. Usually I would use automount to do this, but Lightroom cannot see automounted …

Continue reading »

Written by Rob Allen - - Aggregated on Wednesday August 28, 2019


A first look at Slim 4

With Slim 4 we have continued the tradition of allowing you to use the framework in the way that best fits you and your project. You can create a Slim application entirely in a single file suitable for prototyping through to a few files for a simple web hook or serverless action all the way to fully-decoupled …

Continue reading »

Written by Rob Allen - - Aggregated on Wednesday August 21, 2019


Displaying exif information in WordPress posts

After discovering that WordPress modifies img tags when rendering a page, it crossed my mind that I could display exif information underneath each image on my new photography blog . The basic process is applicable to any manipulation of the content that you would want to do before it is displayed. To do this, we …

Continue reading »

Written by Rob Allen - - Aggregated on Wednesday August 14, 2019


Images and WordPress

My new WordPress project has multiple photographs per post and as I wanted them to work in an efficient manner for multiple screen resolutions. The secret to this is the srcset and sizes attributes on the img tag. It turns out that WordPress will create multiple sized thumbnails when you upload an image. It …

Continue reading »

Written by Rob Allen - - Aggregated on Wednesday August 7, 2019


Developing WordPress sites with Docker

I recently set up a new WordPress based website and local Docker -based development environment. This post documents what I did, so that I can do it again next time! As I'm not in the WordPress world, many things are strange to me and I'm indebted to Jenny Wong for pointing me in the right direction on numerous …

Continue reading »

Written by Rob Allen - - Aggregated on Thursday August 1, 2019


Setting title and caption with exiftool

I recently needed to change the title and caption of some photos, so I turned to exiftool as it's the Swiss Army knife of image metadata. It's a lovely tool with many options, so I wrote a script to make it easy and while I was there, used read to prompt me for the info to set. This is the script: …

Continue reading »

Written by Rob Allen - - Aggregated on Monday July 29, 2019


Creating virtual environments with Pyenv

rst2pdf is a Python 2 application that we're making compatible with Python 3. When developing Python applications, I've found it useful to be able to switch python versions easily and also set up clean environments to work in. To do this, I currently use pyenv . This is how I set it up: Install Pyenv On my …

Continue reading »

Written by Rob Allen - - Aggregated on Wednesday July 17, 2019


Running PHP applications on Azure App Engine

Azure App Service is a way to host your web application in a container without having to think about the server. It's the same PaaS concept as AWS Elastic Beanstalk and supports all the main web programming languages. It also supports Windows and Linux OS containers. I have a client that is moving an on-premises …

Continue reading »

Written by Rob Allen - - Aggregated on Wednesday July 3, 2019