Download the PHP package akankov/html-ast without Composer

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

akankov/html-ast

nikic/php-parser for HTML. A spec-compliant HTML5 abstract syntax tree for PHP, with byte-range positions, trivia preservation, an immutable visitor framework, and a fidelity printer.

CI Latest Version PHP Version

⚠️ 0.x is unstable. The public API shape may change in any minor release until the package reaches 1.0. The 1.0 commitment lands only after the API has been frozen in production for at least two months.

Why this exists

PHP 8.4 ships native HTML5 parsing through \Dom\HTMLDocument (lexbor under the hood). That collapses a decade of fragmented PHP HTML tooling — but \Dom\HTMLDocument is a great parser, not a great AST for transformation work. It has four gaps that html-ast fills:

  1. Byte-range positions on every node. Required for linters, formatters, and source maps. \Dom\HTMLDocument exposes none.
  2. Trivia preservation (whitespace between attributes, comment positions, attribute quoting style). Required for round-trip fidelity. The native serializer drops it.
  3. An immutable visitor framework with enterNode / leaveNode and sentinel return values for replace, remove, and stop. Familiar to anyone who has written a nikic/php-parser visitor.
  4. A fidelity printer. StandardPrinter produces normalized output; LosslessPrinter (v0.2) round-trips trivia exactly.

It also bridges PHP 8.3 (via a masterminds/html5 adapter) and PHP 8.4+ (via the native parser) behind a single Parser interface, so consumers do not need to branch.

Install

PHP 8.3 users additionally need:

(On PHP 8.4+ the native \Dom\HTMLDocument backend is used and there are zero runtime dependencies.)

30-second example

Status

akankov/html-ast is in the M0 design phase — the public API shape is being resolved at docs/design/api-v0.1.md. All implementation classes currently throw \LogicException so type checkers pass while the algorithms are being written. Track the progress on the milestones page.

Documentation

License

MIT, see LICENSE.


All versions of html-ast with dependencies

PHP Build Version
Package Version
Requires php Version 8.3.* || 8.4.* || 8.5.*
ext-dom Version *
ext-libxml Version *
ext-mbstring Version *
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 akankov/html-ast contains the following files

Loading the files please wait ...