PHPActive

typesafe-functions

Type-safe wrappers around PHP’s native functions, tens of thousands of lifetime installs

Install

composer require edmondscommerce/typesafe-functions

PHP’s built-in functions are notoriously loose with their return types (string|false, array|null, and so on). This package wraps the common ones in strictly-typed equivalents that throw instead of silently returning a sentinel value.

Averaging dozens of installs a month on Packagist, on top of tens of thousands of lifetime installs.

Pipeline

Strict return types
Wraps loosely-typed native PHP functions so failures throw instead of returning false/null.