Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Var Dumper Laravel Package

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.

View on GitHub
Deep Wiki
Context7

List of symfony/var-dumper casters with FFI support

Frequently asked questions about Var Dumper
How do I install ffi/var-dumper in a Laravel project?
Run `composer require ffi/var-dumper` in your project root. Ensure PHP 8.1+ and the FFI extension are enabled (`php --enable-ffi` or via PECL). No Laravel-specific configuration is needed—it extends Symfony’s built-in `dump()`/`dd()` helpers.
Will this work with Laravel’s Tinker or debugbar?
Yes, it integrates with Laravel’s existing debugging tools. Use `dump($ffiStruct)` or `dd($ffiPointer)` in Tinker or Debugbar just like native PHP variables. The output will render FFI types in a structured format.
What Laravel versions does ffi/var-dumper support?
It’s compatible with Laravel 10+ (which uses Symfony 6.3+), as it extends Symfony’s VarDumper. Test with your exact Symfony minor version to avoid edge cases, but no Laravel-specific conflicts exist.
How does it handle unsafe memory access (e.g., dangling pointers)?
By default, it flags unsafe reads (like invalid pointers) and shows limited data. Set the environment variable `VAR_DUMPER_FFI_UNSAFE=1` to force full traversal, but use cautiously—this may expose raw memory or crash if pointers are corrupted.
Can I use this to debug FFI structs with nested arrays or pointers?
Yes, it recursively dumps nested FFI structs, arrays, and pointers. For example, a struct containing an array of pointers will display hierarchically. Complex types like `char**` or `void*` are also supported with proper casting.
Does this work with Laravel’s `dd()` helper for FFI types?
Absolutely. Replace `var_dump($ffiVar)` with `dd($ffiVar)` anywhere in your Laravel app, and it will render FFI structs, pointers, and arrays in a readable format while halting execution (like standard `dd()`).
Are there performance concerns when dumping large FFI structures?
FFI reflection adds overhead, especially for large structs or deep pointer chains. Avoid dumping massive FFI objects in production or performance-critical paths. For CI/CD, consider mocking FFI types in tests to speed up debugging.
What if I need to debug FFI types in production? Should I enable `VAR_DUMPER_FFI_UNSAFE`?
No, never enable `VAR_DUMPER_FFI_UNSAFE` in production. It risks exposing raw memory or crashing on invalid pointers. Instead, use it locally or in staging, and log FFI errors to a file for later analysis.
Are there alternatives to ffi/var-dumper for debugging FFI in Laravel?
For basic FFI debugging, you could use `var_dump()` with custom casters, but it lacks structured output. Tools like Xdebug or Blackfire can profile FFI calls but don’t format FFI types. This package is the only dedicated VarDumper extension for FFI.
How do I test if ffi/var-dumper works in my Laravel app?
Create a test FFI struct (e.g., `FFI::new('struct { int x; }')`) and dump it with `dump($struct)`. Verify the output shows the struct’s fields. Test pointers by casting memory (e.g., `FFI::cast('char*', 'string')`) and check for unsafe access warnings.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity