ufito3000/oxygen
Composer 安装命令:
composer require ufito3000/oxygen
包简介
A class to manage objects, properties and JSON files in an easy way
关键字:
README 文档
README
A class to manage objects, properties and JSON files in an easy way
This class make easy to convert simple recursive into other formats. You can read structures or URLs from formats: XML, stdClass and JSON strings.
$o = new Oxygen();
XML
$xml = "<xml><node>Content</node></xml>";
$o->addXML($xml, false);
$xml = "http://your-favorite-url.xml";
$o->addXML($xml, true);
stdClass
$object = new stdClass();
$object->node = "Content";
$o->addO($object);
JSON
$json = '{"node":"Content"}';
$o->addJSON($xml, false);
$json = "http://your-favorite-url.json";
$o->addJSON($xml, true);
Building contents
It can merge objects from this formats and build a bigger object with de sum of all objects.
$object1 = new stdClass();
$object1->node1 = "Content";
$object2 = new stdClass();
$object2->node2 = "More content";
$o->addO($object1)->addO($object2);
$o->getO();
Will return only one object with both properties inside, node1 and node2.
You can build objects calling its properties directly without any implicit declaration. Oxygen assumes when a property is called and it is not previously set, it is a new Oxygen object with all its features available, including implicit declaratio, so that you can write objects as deep as you need this way:
$o->node1 = "Content";
$o->node2->suboject = "More content";
An even
$o->node2->suboject1->subobject2->subobject31 = "Much more content";
$o->node2->suboject1->subobject2->subobject32 = "Much more content";
$o->node2->suboject1->subobject2->subobject33 = "Much more content";
CDATA for XML export is supported.
If youy define CDATA special property, Oxygen interprets that in XML export you want CDATA special tag with HTML inside.
$o->node2->__CDATA__textHTML = "<p>Rock & Roll !!</p>";
$o->node2->__CDATA__otherHTML = "<p>More Rock & Roll !!</p>";
Getting our final product
It can return objets in XML, stdClass and JSON formats.
$o->getO();
$o->getXML();
$o->getJSON();
You can return JSON or XML to output directly without writing any header or echo to browser. Oxygen does it for you.
$o->writeJSON(true);
or
$o->writeXML("xml");
ufito3000/oxygen 适用场景与选型建议
ufito3000/oxygen 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「json」 「xml」 「conversion」 「Oxygen」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ufito3000/oxygen 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ufito3000/oxygen 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ufito3000/oxygen 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A library that provides a simple infrastructure to create your own converters and to perform any conversion you want
Kinikit - PHP Application development framework MVC component
ext-json wrapper with sane defaults
A package to cast json fields, each sub-keys is castable
Load DOM document safety
Fixer.io data provider for Peso
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-23