apsxj/xml
Composer 安装命令:
composer require apsxj/xml
包简介
XML Parsing and Response Library
README 文档
README
XML Parsing and Response Library
Getting Started
- Add the following to your
composer.jsonfile:
"require": { "apsxj/xml": "dev-main" }, "repositories": [ { "type": "git", "url": "https://github.com/apsxj/xml.git" } ]
-
Run
composer install -
Before calling any of the methods, require the vendor autoloader
// For example, from the root directory... require_once(__DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php');
- To create an
Responseobject and render it:
<?php // unwrap classes from the apsxj\xml namespace use apsxj\xml\Node; use apsxj\xml\Doc; use apsxj\xml\Response; // Create the doctype declaration node $doctype = Node::element( '!DOCTYPE', array( 'html' => 'html' ) ); // Create the HTML node $html = Node::element( 'html', array( 'lang' => 'en', 'class' => 'h-100' ), array( Node::text('<head><title>It works!</title></head><body><h1>It works!</h1></body>') ) ); // Create the Document $doc = new Doc($doctype, $html); // Pass the document to a new Response object $response = new Response($doc); // Render the response $response->render(200);
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-05-09