PHP Streams

Creating A Game With PHP Part 1: Detecting Key Input

8th November 2020 - 4 minutes read time

I was watching a documentary about old computers on YouTube recently and it showed a video of an early computer game creating using the command line. This wasn't a text based adventure game, but a game creating using text for the graphics running as a program on the command line. This got me thinking that creating something like this should be possible using PHP. If it was possible on a 30 year old computer then surely it's possible to get PHP to do it, right? I thought it might be interesting to create a series of posts showing how to put this together.

PHP Custom Stream Filters

29th December 2019 - 8 minutes read time
Stream filters allow changes to be made to textual data in streams. This allows text to be changed when writing to or reading from streams, instead of changing the text after the stream has been run. There is a framework built into PHP that allows custom filters to be added to the group of built in filters.

PHP Custom Stream Wrappers

24th December 2019 - 7 minutes read time
Part of the strength of PHP's stream wrappers is the ability to add our own stream wrappers to the list of available wrappers. We can therefore natively open any type of resource just by registering a stream wrapper and then using the normal fopen() functions. The custom stream wrapper functionality is made possible through a few functions built into PHP.