ffi/var-dumper

List of symfony/var-dumper casters with FFI support

Maintainers

👁 Serafim

Package info

github.com/php-ffi/var-dumper

Documentation

pkg:composer/ffi/var-dumper

Statistics

Installs: 11 273

Dependents: 4

Suggesters: 0

Stars: 19

Open Issues: 0

1.0.3 2026-03-25 11:20 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 031b5b13a8e130b63414bba8d2b0eaa7817c21db

symfonyvar-dumpercastersffi

This package is auto-updated.

Last update: 2026-06-25 12:03:31 UTC


README

👁 PHP 8.1+
👁 Latest Stable Version
👁 Latest Unstable Version
👁 Total Downloads
👁 License MIT

👁 Image

This library allows you to dump FFI types using the functions dd() and dump().

Requirements

  • PHP >= 8.1

Installation

Library is available as composer repository and can be installed using the following command in a root of your project.

$ composer require ffi/var-dumper

Usage

dump(\FFI::new('struct { float x }'));

//
// Expected Output:
//
// struct <anonymous> {
// x<float>: 0.0
// }
//

Unsafe Access

Some values may contain data that will cause access errors when read. For example, pointers leading to "emptiness".

Such data is marked as "unsafe" and only the first element is displayed. If you want to display the values in full, you should use the VAR_DUMPER_FFI_UNSAFE=1 environment variable.

// Create char* with "Hello World!\0" string.
$string = \FFI::new('char[13]');
\FFI::memcpy($string, 'Hello World!', 12);
$pointer = \FFI::cast('char*', $string);

// Dump
dump($pointer);

// VAR_DUMPER_FFI_UNSAFE=0
//
// > char* (unsafe access) {
// > +0: "H"
// > }

// VAR_DUMPER_FFI_UNSAFE=1
//
// > b"Hello World!\x00"