← CodeClarityLab Home
Browse by Category
+ added · updated 7d
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Diagram: PHP Fibers — Internals & Scheduler Patterns PHP Fibers — Internals & Scheduler Patterns PHP 8.1+
How PHP Fibers work under the hood — stack allocation, suspension mechanics, and how to build a cooperative multitasking scheduler on top of the Fiber API introduced in PHP 8.1.
1mo ago php advanced
Abstract readonly Properties PHP 8.4+
PHP 8.4 allows abstract readonly properties in abstract classes and interfaces — defining that implementations must provide a readonly property of a specific type.
2mo ago php advanced
DNF Types (PHP 8.2) PHP 8.2+
PHP 8.2 DNF (Disjunctive Normal Form) types allow unions of intersections — (Countable&Iterator)|null — combining PHP 8.1 intersection types with union types.
2mo ago php advanced
FFI — Foreign Function Interface (PHP 7.4) PHP 7.4+
PHP 7.4 FFI allows calling C functions and accessing C data structures directly from PHP — enabling Python-like ctypes integration for native libraries without writing C extensions.
2mo ago php advanced
Fibers — Cooperative Concurrency (PHP 8.1) PHP 8.1+
PHP 8.1 Fibers enable cooperative multitasking — suspending execution at yield points and resuming later — the foundation for async PHP frameworks without OS threads.
2mo ago php advanced
Intersection & DNF Types in Practice PHP 8.1+
PHP 8.1 intersection types (A&B) and PHP 8.2 DNF types ((A&B)|null) allow precise type constraints for objects implementing multiple interfaces.
2mo ago php advanced
JIT Compiler Introduction (PHP 8.0) PHP 8.0+
PHP 8.0's JIT (Just-In-Time) compiler compiles hot bytecode to native machine code at runtime — significant gains for CPU-bound tasks, minimal gains for typical web requests.
2mo ago php advanced
OPcache Preloading (PHP 7.4) PHP 7.4+
OPcache preloading (PHP 7.4) compiles PHP files into shared memory at server start — eliminating per-request compilation of framework core files for significant performance gains.
2mo ago php advanced
PCNTL Signals in CLI PHP PHP 7.1+
The PCNTL extension lets CLI PHP scripts handle OS signals (SIGTERM, SIGINT, SIGUSR1) — enabling graceful shutdown and hot reload in long-running daemons.
2mo ago php advanced
PHP Garbage Collection Internals (Cycle Collector) PHP 5.3+
PHP uses reference counting as its primary memory management strategy — when a value's reference count drops to zero it is freed immediately. A secondary cycle collector handles circular references that reference counting alone cannot free.
2mo ago php advanced
PHP Memory Model — Zval & Copy-on-Write PHP 7.0+
PHP stores every value in a zval (Zend value) container that holds the type, value, and a reference count. Arrays and strings are copied lazily — the copy only happens when one copy is modified (copy-on-write), making passing large values cheap until mutation.
2mo ago php advanced
PHP Sodium Extension (Libsodium) PHP 7.2+
The Sodium extension (bundled since PHP 7.2) provides modern, misuse-resistant cryptography via the libsodium C library — covering authenticated encryption, key exchange, password hashing with Argon2, and digital signatures with a simple, safe API.
2mo ago php advanced
Property Hooks (PHP 8.4) PHP 8.4+
PHP 8.4 property hooks add get and set accessors directly to property declarations — eliminating the need for explicit getter/setter methods on simple value objects.
2mo ago php advanced
Socket Programming with PHP PHP 5.0+
PHP supports raw socket programming via the Sockets extension (socket_create) and stream sockets (stream_socket_client) — used for custom protocols, WebSocket servers, and network tools.
2mo ago php advanced
Fiber-Based Task Scheduler PHP 8.1+
Building a cooperative multitasking scheduler with PHP Fibers — suspending and resuming tasks at I/O wait points to run multiple tasks concurrently in a single thread.
2mo ago php advanced
Generics Workarounds in PHP PHP 7.0+
PHPDoc @template annotations with PHPStan/Psalm provide compile-time type-safe generics with zero runtime cost — the standard approach for typed collections and repositories.
2mo ago php advanced
Lazy Objects (PHP 8.4) PHP 8.4+
PHP 8.4 native lazy object proxies defer initialisation until first access — enabling zero-cost dependency injection of services that may never be used in a request.
2mo ago php advanced
PHP Intl Extension — Unicode PHP 5.3+
Grapheme functions, Normalizer, and Transliterator — correct multilingual text handling beyond what mb_string provides, including emoji and combining characters.
2mo ago php advanced
Property Hooks (PHP 8.4) PHP 8.0+
PHP 8.4 property hooks attach get and set logic directly to a property declaration — co-locating validation and transformation with the property itself.
2mo ago php advanced
Type Widening & Covariance/Contravariance PHP 7.4+
PHP's rules for overriding method types in subclasses — return types are covariant (can narrow), parameter types are contravariant (can widen), enforced since PHP 7.4.
2mo ago php advanced
✓ schema.org compliant