Download the PHP package lucid/xml without Composer

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

XML writer and parser utilities

Author Source Code Software License

Build Status Code Coverage HHVM

Installing

Testing

Run tests with:

The Parser

The Parser class can parse xml string, files, DOMDocuments, and DOMElements into a php array.

Parsing xml strings

Parsing xml files

Parsing a DOMDocument

Parsing a DOMElement

Parser Options

Dealing with Attributes

Xml attributes are captured as an deticated section within the actual node data. The section key defaults to @attributes, but can be changed using the setAttributesKey method.

Merging attributes

Setting Parser::mergeAttributes(true) will merge any attributes as key/value into the data set.

The above example will output something simmilar to this:

Normalizing keys

You may specifay how keys are being transformed by setting a key normalizer callback.

The default normalizer transforms dashes to underscores and camelcase to snakecase notation.

Set index key

This forces the parser to treat nodes with a nodeName of the given key to be handled as list.

Set a pluralizer

By default the parser will parse xml structures like

To something like:

Setting a pluralizer can fix this.

Note, that a pluralizer can be any callable that takes a string and returns a string.

The Writer

Dumping php data to a xml string

Dumping php data to a DOMDocument

Note: this will create an instance of Lucid\Xml\Dom\DOMDocument.

Writer options

Set the normalizer instance

Normaly, the NormalizerInterface implementation is set for you when instantiating a new Writer, however you can set your own normalizer instance.

Note: the normalizer must implement the Lucid\Xml\Normalizer\NormalizerInterface interface.

Set the inflector

The inflector is the exact oppoite of the Parser's pluralizer. It singularizes strings.

Set the document encoding

Default encoding is UTF-8.

Set an attribute key map

This is usefull if you want to output certain keys as xml attribute

Note: you can also use use addMappedAttribute($nodeName, $attributeName) to add more mapped attributes.

Set value keys

The data structure above would dump the following xml string

However, if you need the value node as actual value of the parent node, you may use Writer::useKeyAsValue(string $key) to do so

now dumps:

Writing indexed array structure

Indexed arrays will create xml structures like the example below:

You can change the node names associated with indexed items by using the useKeyAsIndex(string $key) method.

Writing arrays with none valid index keys

Arrays containing invalid indices (e.g. unordererd lists) will be treated slightly different.


All versions of xml with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
lucid/common Version dev-master
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 lucid/xml contains the following files

Loading the files please wait ....