saylornotes

The Blog of Chris Saylor

Why Use Generators in PHP

January 2, 2017 engineering
I’ve heard many co-workers, friends, and colleagues at meetups acknowledge the existence of generators in PHP, but not understand why they would use them or give them much thought when planning out implementations. In this article, I’m going to explain with concrete examples of when it is a good idea to use a generator. In case you don’t know what a generator is, you can check PHP’s documentation on the subject for a good synopsis. Continue reading
PHP

Enforce code standards with composer, git hooks, and phpcs

April 14, 2014 engineering
Maintaining code quality on projects where there are many developers contributing is a tough assignment. How many times have you tried to contribute to an open-source project only to find the maintainer rejecting your pull request on the grounds of some invisible coding standard? How many times as a maintainer of an open-source project (or internal) have you had a hard time reading code because there were careless tabs/spaces mixed, if statements with no brackets, and other such things. Continue reading