icecave/repr 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

icecave/repr

最新稳定版本:4.0.0

Composer 安装命令:

composer require icecave/repr

包简介

A library for generating string representations of any value, inspired by Python's reprlib library.

README 文档

README

Build Status Code Coverage Latest Version

Repr provides a way to generate informational string representations of any value, inspired by Python's reprlib library.

composer require icecave/repr

Example

Use the Repr::repr() method to obtain a string representation for any type.

use Icecave\Repr\Repr;

echo Repr::repr([1, 2, 3]);

The output from the example above is:

[1, 2, 3]

Arrays

Arrays are represented using PHP 5.4 style short array notation. By default a maximum of 3 elements are shown along with a count of any additional elements. Nested arrays are represented up to 3 levels deep by default, with any arrays nested deeper than this showing only the element count.

Numeric Values

Numbers are represented naturally, floating point values will always display a decimal point even if representing a whole number.

Strings

Strings are represented enclosed in double quotes up to a default maximum length of 50 characters. Any control characters are shown as escape sequences.

Objects

Objects are represented as a class name and SPL object hash enclosed in angle brackets. If the object has a __toString method, the result of this is shown after the class name according to the rules of string representations specified above.

If an object implements RepresentableInterface, the result of its stringRepresentation() method is used instead.

Resources

Resources are represented as a resource type and ID enclosed in angle brackets. Stream resources will also display the stream mode.

Other Types

All other types are represented by the result of var_export() in lowercase.

统计信息

  • 总下载量: 6.46M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 27
  • 点击次数: 3
  • 依赖项目数: 5
  • 推荐数: 0

GitHub 信息

  • Stars: 26
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固