承接 ffi/var-dumper 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ffi/var-dumper

最新稳定版本:1.0.2

Composer 安装命令:

composer require ffi/var-dumper

包简介

List of symfony/var-dumper casters with FFI support

README 文档

README

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

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"

统计信息

  • 总下载量: 10.13k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 20
  • 点击次数: 1
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 19
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-31