theseer/fdomdocument
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
TheSeer/fDOMDocument is an extended version of the PHP's standard DOM. This package is designed to provide more robust error handling by throwing exceptions when errors occur rather than PHP warnings or notices. Plus, it introduces additional custom methods and shortcuts for user convenience, making DOM usage a lot simpler.
To use TheSeer/fDOMDocument, you need to first install it via composer by adding it to your project's requirements. This is how your composer.json file should look like:
{
"require": {
"theseer/fdomdocument": "^1.6"
}
}
After successful installation, fDOMDocument can be included in your PHP script through the composer-generated autoload.php file. The following code demonstrates an example usage of fDOMDocument:
<?php
require '/path/to/autoload.php';
$dom = new TheSeer\fDOM\fDOMDocument();
try {
$dom->loadXML('<?xml version="1.0" ?><root><child name="foo" /></root>');
} catch (fDOMException $e) {
die($e);
}
$child = $dom->queryOne('//child');
print_r($child->getAttribute('name'));
print_r($child->getAttribute('missing','DefaultValue'));
?>
In this example, an instance of fDOMDocument is created and an XML content is loaded into this object. The 'loadXML' method might throw a 'fDOMException' if the XML is not valid. The convenience function 'queryOne' is then used to select the 'child' element. The 'getAttribute' method provides access to the attributes of the selected element.
The documentation for TheSeer/fDOMDocument package is currently not hosted on a specific documentation website. Instead, you can find information on how to use the package and details about its implementation on the GitHub Readme file. For additional examples, usage details or debugging information, feel free to explore the source code itself to get a better understanding of the package's capabilities.