Why @@ is the best attribute syntax for PHP

Analogous to docblock annotations, attributes make it possible to apply metadata to a class, function, or property with a native syntax and reflection API. The original <<Attr>> syntax accepted for PHP 8.0 had several shortcomings which were addressed by changing the syntax to @@Attr. Now there is a new proposal to borrow Rust’s #[Attr] syntax instead. In this post I examine the main arguments for this change and why I still believe the @@ syntax is best.

PolyCast: a library for safe type conversion in PHP

On March 16, 2015, something amazing happened in the world of PHP. The long-awaited, hotly debated Scalar Type Declarations RFC was accepted for PHP 7! Finally, it will be possible to declare scalar types (int, float, bool, and string) for function parameters and return values: The need for safe type casts By default, scalar types… Continue reading PolyCast: a library for safe type conversion in PHP

Responsive Captcha: A small PHP library for preventing spam

If you’re reading this, you probably already know what a CAPTCHA is. The most common form consists of an image with warped or obscured characters which must be entered into a text field. While these image-based CAPTCHAs tend to be effective at stopping spam, they are also poorly accessible, often slow, and require a third-party… Continue reading Responsive Captcha: A small PHP library for preventing spam