Download the PHP package magento/dom without Composer
On this page you can find all versions of the php package magento/dom. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package dom
Modern DOM API.
Built on top of PHP's native DOMDocument, this project provides access to modern DOM APIs, as you would expect working with client-side code in the browser.
Performing DOM manipulation in your server-side code enhances the way dynamic pages can be built. Utilising a standardised object-oriented interface means the page can be ready-processed, benefitting browsers, webservers and content delivery networks.
Example usage: Hello, you!
Important note: the example shown here is for illustrative purposes, but using the DOM to directly set data to elements' values tightly couples the logic to the view, which is considered bad practice. Please see the DomTemplate library for a more robust solution to binding data to the DOM.
Consider a page with a form, with an input element to enter your name. When the form is submitted, the page should greet you by your name.
This is a simple example of how source HTML files can be treated as templates. This can easily be applied to more advanced template pages to provide dynamic content, without requiring non-standard techniques such as {{curly braces}}
for placeholders, or echo '<div class='easy-mistake'>' . $content['opa'] . '</div>'
horrible HTML construction from within PHP.
Source HTML (name.html
)
PHP used to inject your name (index.php
)
Features at a glance
- DOM level 4 classes:
HTMLDocument
Element
HTMLCollection
- and more extended DOM classes
- Standardised traits to add functionality in accordance with W3C
- Reference elements using CSS selectors via
querySelector
(All
) - Add/remove/toggle elements' classes using
ClassList
Element
Nodes within the document traversable with W3C properties:Element::remove()
to detach it from the document- Add elements around another using
Element::before()
andElement::after()
- Replace an element in place using
Element::replaceWith()
- Standard collection properties on the
HTMLDocument
:
Page template features
This repository is intended to be as accurate to the DOM specification as possible. An extension to the repository is available at https://php.gt/domtemplate which adds page templating through custom elements and template attributes, introducing serverside functionality similar to that of WebComponents.
All versions of dom with dependencies
ext-dom Version *
ext-libxml Version *
ext-mbstring Version *
magento/cssxpath Version *
psr/http-message Version 1.*