thecodingmachine/safe
Safe PHP functions: a drop-in wrapper around PHP’s native functions that converts warnings and notices into exceptions, improving type safety and error handling. Includes namespaced alternatives for many standard functions with IDE/static analysis support.
Architecture fit: Perfect alignment with Laravel's exception-driven error handling philosophy. Safe complements Laravel's built-in abstractions (e.g., File facade) by extending exception-based safety to raw PHP functions not covered by Laravel's ecosystem. This creates a unified error-handling pattern across the codebase.
Integration feasibility: High. Composer dependency with minimal configuration. Drop-in replacements (Safe\file_get_contents) require only replacing native function calls. Laravel's autoloading handles namespace resolution seamlessly. No framework-specific modifications needed.
Technical risk: Moderate. Key risks include:
false checks may break without proper exception handlingHow can I help you explore Laravel packages today?