Download the PHP package perry-rylance/dom-document without Composer

On this page you can find all versions of the php package perry-rylance/dom-document. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package dom-document

DOMDocument

An extension of PHP's DOMDocument library. This library implements many common jQuery functions, adds support for HTML5, CSS selectors, method chaining and performing operations on sets of matched results.

IMPORTANT NOTICE - The future of this library

With the release of PHP 8.4's new DOM features, the core features of this package are now supported natively, that is, HTML5 and CSS selectors.

Whilst this library is still compatible, if there are any future versions then I will be handing over this functionality to PHP's new DOM classes.

I have experimented with the new version and as far as I can tell there is now no means to register our own classes as extensions of the built in node class. The HTMLDocument is final and I cannot see any documented way to register node classes. With that said, the documentation hasn't been updated yet, neither has Intelephense seemingly.

I will wait until the documentation has been updated and then decide whether this package will be deprecated or not. I may also take this library in a different direction such as providing a single jQuery like function to manipulate documents without touching or extending the built in implementation.

Please watch this space!

Requirements

Installation

I recommend installing this package via Composer.

composer require perry-rylance/dom-document

Usage

Instantiate DOMDocument and enjoy the jQuery-like functions now at your disposal.

As of version 2.0.0, this library does not add jQuery-like methods to DOMElement, in order to avoid future collisions with the HTML living standard spec. Rather, these jQuery-like methods are implemented on DOMObject in the same manner jQuery objects work.

Documentation

Read the libraries documentation.

The requirements to generate documentation are as follows:

To generate documentation, use the following command.

php <path/to/your/phpDocumentor.phar> -t ./docs --ignore vendor/

Testing & Development

As of 3.0.0, tests are run via Docker to facilitate cross PHP version testing.

All tests can be run by running tests.sh.

To run individual tests from your native CLI:

docker-compose run php82 php /app/vendor/bin/phpunit tests --filter=testCastToString

Migrating from 2. to 3.

Version 2.* is not compatible with PHP 8.3, version 3.0.0 addresses this.

Breaking changes

Migrating from 2.0. to 2.1.

Breaking changes

Migrating from 1.0. to 2.

If you are considering switching from 1.0.* to >= 2.0.0 please note there are some considerations to be aware of.

Moved methods

Many, many methods which were previously implemented on DOMElement are now on DOMObject. This helps avoid collisions with PHP's native DOMElement as more convenience methods are added there, like in the recent RFC sprint.

Avoid querySelector

The method querySelector is still implemented and publicly visible for internal reasons, however, I'd recommend avoiding using this method.

Any code which did expect a single DOMElement from querySelector may now create fatal errors.

DOMDocument::querySelector now returns a DOMObject in an effort to make almost all common methods still available and keep old code stable, however, some methods (such as isBefore) are not implemented by DOMObject. These methods are intended for internal use. Documentation will be updated to reflect this.

Static contains

DOMElement::contains is now static, in line with jQuery's design pattern. This may create warnings for users migrating from older versions.

PHP requirement

This library has dropped support for PHP < 8.2.0 in version >= 3.0.0.

Enhanced manipulation

Many methods, such as append, prepend, before, after, wrap, and many others, now support passing in an entire array or DOMObject as an argument.

This can be used to append content to multiple elements, where there is more than one element in the set.

If the target set contains only one element, then the same elements passed into these functions will be added to the DOM tree.

If the target set contains multiple elements, then the input elements will be cloned - please note that manipulating the input set after performing these operations may not affect the DOM tree, because the new content is cloned from the input set.

Support

Please feel free to open issues here or submit pull requests.


All versions of dom-document with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2.0
ext-dom Version *
masterminds/html5 Version ^2.7
symfony/css-selector Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package perry-rylance/dom-document contains the following files

Loading the files please wait ....