Download the PHP package commnetivity/purehtml without Composer

On this page you can find all versions of the php package commnetivity/purehtml. 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 purehtml

Build Status (actually, this class works, but the builds fail because there are no PHP Unit tests and instructions set up yet for Travis-CI)

PureHTML DOM Processor

This library leverages the speed and flexibility in using PHP's native DOM processor to let you parse, strip, splice and even beautify your HTML pages.

Installation

The easiest way to get started is using Composer to install commnetivity/purehtml:

Beautify DOM function, explained:

This is a PHP function that beautifies the output of an HTML document by adding indentation and line breaks to make it more readable. Here is a breakdown of how it works:

  1. The function takes two parameters: $doc, which is the HTML document as a DOMDocument object, and $depth, which is the current depth of the recursion (default value is 1).
  2. It creates a new DOMXPath object to query the HTML document.
  3. It loops through all the text nodes in the HTML document using XPath, and removes any leading or trailing whitespace (including newlines, carriage returns, and spaces) from their values. If the resulting value is an empty string, it removes the node entirely.
  4. It defines a recursive function called $format that takes three parameters: $dom, which is the DOMDocument object representing the HTML document, $currentNode, which is the current node being formatted, and $depth, which is the current depth of the recursion.
  5. If $currentNode is false, it removes the first child node of $dom (which is typically the <!DOCTYPE> declaration) and sets $currentNode to $dom itself.
  6. It determines whether the current node should be indented by checking if it is a text node and its parent only has one child node. If so, it sets $indentCurrent to false; otherwise, it sets it to true.
  7. If $indentCurrent is true and $depth is greater than 1, it creates a new text node with a newline and $depth spaces and inserts it before $currentNode.
  8. It loops through all the child nodes of $currentNode and recursively calls $format on each one, passing in $dom, the child node, and $depth+1.
  9. If any of the child nodes was indented, it sets $indentClosingTag to true.
  10. If $indentClosingTag is true, it creates a new text node with a newline and $depth spaces (unless the current node is the <html> tag), and appends it to $currentNode.
  11. The function calls $format with $doc as the first argument and no second argument (which sets $currentNode to false), effectively formatting the entire HTML document.
  12. The function returns the formatted HTML document with a <!DOCTYPE> declaration at the beginning.

All versions of purehtml with dependencies

PHP Build Version
Package Version
No informations.
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 commnetivity/purehtml contains the following files

Loading the files please wait ....