ntlab/php-obj 问题修复 & 功能扩展

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

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

ntlab/php-obj

最新稳定版本:v1.9.0

Composer 安装命令:

composer require ntlab/php-obj

包简介

A PHP object representation as string, javascript, annotation, or YAML

README 文档

README

Build Status Latest Stable Version Total Downloads License

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-21