Download the PHP package stein197/xml-builder without Composer

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

PHP XML Builder

About

This package helps to create XML/HTML output directly from PHP code. The package generates very simplified node tree. Output can be generated by the tree in two ways - beautified output (all indentations and line feeds are present) and minified (without any intentations and line feeds). Also output can be generaten in two modes - HTML and XML mode (all tags are closed). The package generates valid HTML/XML markup and if you need - creates minified output on the fly.

To start using it include it via composer:

Examples

Simple example:

outputs:

Any method call on Builder is proxied through __call() method, so the name of the method == tag name. To create dashed tag name, call a method in camelCase:

To create namespaced element, call a method in snake_case:

If you need to place underscore, double the _ sign:

If you need tag which name contains invalid characters for PHP method, or if it points to already existing method, call tag() method. The first argument is tag name others could be callbacks, attributes etc.:

All tag names are lowercased. To create CDATA section and XML comment call these methods respectively:

Comments are cut out in minified output.

To create <?xml?> element, pass an array of attributes to the constructor:

__toString() outputs minified HTML version by default. You can change the behaviour by calling stringify() method directly:

Output of the second line:

Of course the level of nesting could be infinite:

You can create attributes and content of an element, by passing an array and arbitrary data as arguments to tag method:

Also you can pass another builder later if you need one:

In case if you need custom content for a tag, you should return non-null value from callback. Method calls on callback argument do not affect the tree, only returned value:

The order of arguments does not matter. Arrays are always attributes, while everything else is content. Multiple content arguments are concatenated, while only last array considered as attributes.

If an output is minified and a mode is HTML, then the empty elements do not have closing slash. List of self-clising HTML tags:


All versions of xml-builder 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 stein197/xml-builder contains the following files

Loading the files please wait ....