azjezz/psl
PSL is a modern, well-typed standard library for PHP 8.4+, inspired by HHVM’s HSL. It offers safer, predictable APIs for async, collections, networking, I/O, crypto, terminal UI, and robust data validation—replacing brittle built-ins with consistent alternatives.
The Class component provides type-safe wrappers around PHP's built-in class reflection and existence checks. It replaces loose class_exists() calls with a consistent, intention-revealing API and adds helpers for inspecting class properties.
PHP's native class_exists() accepts a second argument to control autoloading, which is easy to forget or misuse. PSL separates that choice into two distinct functions -- exists() (triggers autoloading) and defined() (checks only already-loaded definitions) -- so the intent is always clear.
@example('other/reflection-exists.php')
@example('other/reflection-inspect.php')
Guard a factory method against invalid input:
@example('other/reflection-factory.php')
See src/Psl/Class/ for the full API.
How can I help you explore Laravel packages today?