Posts Tagged “PHP”
While trying to compile PHP extensions after installing macOS Mojave, I was butting up against a ton of missing header file errors including php.h and zlib.
After several hours of beating my head against my desk and Googling/Stack Overflowing I found the solution.
Ends up you just need to force re…
Read More / Comment »
I am someone who spends large portions of their time working in weakly typed languages. Namely, PHP and JavaScript. I argue that static analysis is a must-have when working with any weakly typed language. It is nearly impossible to make reliable code without it.
Static analysis makes up for the mi…
Read More / Comment »
Should you run into errors related to missing php.h or other .h files, you should check out my post on fixing missing headers on macOS Mojave.
These directions are for working with the native installation of PHP. Your results may vary if you are using a brew, MAMP or otherwise installed version of…
Read More / Comment »
Every time I would upgrade OS X it took probably 45 minutes of fiddling with my Apache configuration to get it working properly. I'm writing this article in the hopes of saving myself and others some time.
The Setup
For the following examples, {username} represents your username.
Firstly, if you…
Read More / Comment »
I previously showed you how to Load a Github Gist with Composer, but sometimes you need to install code that isn't isn't even in a public facing VCS.
I for instance wanted to use a library only distributed by Zip.
It's actually fairly easy! In your composer.json file, you simply add a repositories…
Read More / Comment »
Lost in the shiny new features (see: namespaces and closures) PHP 5.3 also added the __invoke method. While not plainly apparent, it is secretly an amazingly useful 'magic method' .
If you're not taking advantage of __invoke, you should be. Why? It provides a uniform execution points for objects t…
Read More / Comment »
Over the weekend I went to a talk on Scala. The speaker said variety of harsh, inflammatory, and mostly wrong things about PHP and the PHP community.
One such example:
The PHP community doesn't care about things like lambdas, they just care about getting a site up as fast as possible.
This is j…
Read More / Comment »
Composer is amazing for pulling in packages, but what if you find a Gist that isn't Composer aware? Fear not, as Composer has the magical ability to pull in repositories not explicitly set up in Packagist by defining them in the "repositories" section.
But what if you wanted to load a single class…
Read More / Comment »
Please Note
This tutorial only covers the default PHP installation that ships with Mac OS X / macOS. If you have installed a new installation this does not cover you.
For those using brew, you can simply brew install the appropriate brew formula for the extension.
These directions are verified t…
Read More / Comment »
In my professional work, we have a system that utilizes __call and __callStatic for caching of certain method calls. We have been running into a problem where calling an undefined method via :: within the class itself will trigger __call rather than the expected __callStatic.
The Problem
The follo…
Read More / Comment »
Working on a class in our application, I discovered that it was being included before a number of constants it used for its members were even defined. Puzzled on how this had never been a problem I started to experiment; echoing the member at the bottom of the class file after the class closed show…
Read More / Comment »
So yesterday I was bored and asked my friend what I should do. She replied "I don't know, draw ASCII art or something!" and sitting there with the terminal open I kind of wondered what it would take to write one of those image to ASCII scripts.
20 minutes later I had the following PHP Shell Script…
Read More / Comment »
When I switched from an older MacBook Pro to a MacBook Air the backup from my old MacBook Pro was corrupted and unmountable. However, I had preserved a backup of my Photo Booth Photos and wanted the Photo Booth application to recognize them. This is just a matter of creating a Recents.plist, an orde…
Read More / Comment »
It would seem there is a fair deal of call for an updated version of my PhpED dark theme from colleagues as well as random folks on the internet who’ve seen screenshots of my PhpED installation. I previously had my Dark Theme for 5 linked on my Review of PhpED, but I figured I could have a page ded…
Read More / Comment »
All in one function to parse User Agent strings into their important bits.
Read More / Comment »
Several months ago I was wondering to myself if you could detect patterns in a list of words and then use those patterns to generate a new list of fake “words”. A kind of a flavored Lorem Ipsum generator, where I could change the feel of the sentences by switching out the data set. I’m sure thousan…
Read More / Comment »
With Google recently starting to involve load time in search rankings, there has been a lot of talk about GZIP. Google Webmaster Tools exclaims "Compressing the following resources with gzip could reduce their transfer size by XKB:". Many people listen to this, and go out looking for a quick fix…
Read More / Comment »
“There Isn't an App For That” - Windows Apps I haven't been able to replace in Mac OS X
For a very long time I was a Windows guy, I was once a DOS guy. I switched nearly exclusively to Mac for my home use about 4 years ago. I’ve been very happy with it. Its stable, well engineered, and - my favorit…
Read More / Comment »