ffi/var-dumper
Adds Symfony VarDumper support for PHP FFI types so dd() and dump() render structs, arrays, pointers, and more in a readable form. Includes “unsafe access” detection for risky pointer reads, with an env flag (VAR_DUMPER_FFI_UNSAFE=1) to fully inspect data.
var-dumper to support FFI (Foreign Function Interface) types, enabling debugging of C/C++ data structures, pointers, and memory layouts directly in PHP. It is not a core framework dependency but a debugging utility, making it ideal for:
var_dump() or dd() fall short for FFI types.var-dumper (via symfony/var-dumper), so this is a drop-in extension with no architectural conflicts. No changes to Laravel’s core debugging flow are required.composer require with no configuration. Usage mirrors Laravel’s existing dump()/dd() helpers.php --enable-ffi or pecl install ffi). This is a hard dependency and must be pre-validated in the target environment.var-dumper). Laravel 10+ uses Symfony 6.3+, so no version conflicts exist, but testing with the exact Symfony minor version is recommended.VAR_DUMPER_FFI_UNSAFE flag introduces runtime configuration, which may complicate:
struct, char*, void*) that are critical to debug?VAR_DUMPER_FFI_UNSAFE be safely enabled in production (risk of exposing raw memory)?xdebug or blackfire provide similar insights without FFI?dump(), dd(), Tinker). No changes to existing workflows.libcurl, zlib).sudo apt-get install php-ffi (Linux) or compile with --enable-ffi.FFI::cdef('int printf(const char* format, ...);'); FFI::printf("Hello");.composer require ffi/var-dumper
var_dump($ffiStruct) with dump($ffiStruct).FFI::new('struct { int x; }').FFI::cast('char*', 'string').VAR_DUMPER_FFI_UNSAFE=1 and test edge cases.php.ini or Dockerfiles.| Component | Compatibility Status | Notes |
|---|---|---|
| Laravel 10+ | ✅ Full | Uses Symfony 6.3+ var-dumper. |
| PHP 8.1+ | ✅ Required | FFI is PHP 7.4+, but package enforces 8.1+. |
| Symfony 7/8 | ✅ Supported | Explicit version checks in package. |
| FFI Extension | ⚠️ Hard Dependency | Must be enabled manually. |
| Windows/Linux/macOS | ✅ Cross-platform | FFI works on all, but some structs may differ. |
services: php:8.2-ffi).VAR_DUMPER_FFI_UNSAFE to .env.testing if needed.var-dumper: Laravel’s updates may require package version alignment (monitor Symfony’s BC breaks).printf-style debugging of FFI types.dd() for stack traces + FFI context.VAR_DUMPER_FFI_UNSAFE usage.gdb/lldb for deep C-level debugging.Valgrind to detect memory issues.dd() sparingly in production.| Scenario | Impact | Mitigation |
|---|---|---|
| FFI extension disabled | Dumps fail silently | Enforce FFI in php.ini/Docker. |
| Unsafe memory access | Crashes or corrupt output | Restrict VAR_DUMPER_FFI_UNSAFE to dev. |
| Struct ABI incompatibility | Garbled output | Test on target OS/architecture. |
| Symfony version mismatch | Package fails to load | Pin symfony/var-dumper version. |
| Heavy FFI usage in production | Performance degradation | Disable dumps in config/app.php. |
How can I help you explore Laravel packages today?