ntlab/php-obj
最新稳定版本:v1.9.0
Composer 安装命令:
composer require ntlab/php-obj
包简介
A PHP object representation as string, javascript, annotation, or YAML
README 文档
README
Represent PHP object as string, javascript, annotation, or YAML.
Examples
-
Represent PHP object as string
<?php use NTLAB\Object\PHP; $a = new PHP([1, 2, 3], ['inline' => true]); echo (string) $a; // [1, 2, 3] $a = new PHP(['name' => 'Apple', 'color' => 'Red', 'description' => 'It\'s yummy...'], ['inline' => true]); echo (string) $a; // ['name' => 'Apple', 'color' => 'Red', 'description' => 'It\'s yummy...']
-
Represent PHP object as annotation
<?php use NTLAB\Object\Annotation; $a = new Annotation(['name' => 'Apple', 'color' => 'Red', 'description' => 'It\'s yummy...'], ['annotation' => '@Fruit', 'inline' => true]); echo (string) $a; // @Fruit(name="Apple", color="Red", description="It's yummy...")
-
Represent PHP object as javascript
<?php use NTLAB\Object\JS; $a = new JS(['name' => 'Apple', 'color' => 'Red', 'description' => 'It\'s yummy...'], ['inline' => true]); echo (string) $a; // {name: 'Apple', color: 'Red', description: 'It\'s yummy...'}
- Represent PHP object as YAML
<?php use NTLAB\Object\YAML; $a = new YAML(['name' => 'Apple', 'color' => 'Red', 'description' => 'It\'s yummy...']); echo (string) $a; // name: // Apple // color: // Red // description: // It's yummy...
统计信息
- 总下载量: 1.97k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-21