Download the PHP package kiwilan/php-xml-reader without Composer

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

PHP XML Reader

Banner with cards catalog picture in background and PHP XML Reader title

php version downloads license tests codecov

PHP package to read XML with nice API, heavily inspired by stackoverflow answer.

About

PHP have native functions to read XML files with SimpleXML, but it's not easy to use and not very flexible. This package offer to read XML files as array, with a simple and flexible API.

Requirements

Installation

You can install the package via composer:

Usage

You can read XML from path or from content.

Methods

Method Description Type
$xml->getRoot() Value of root element ?string
$xml->getRootNS() Namespaces of root element string[]
$xml->getRootAttributes() Attributes of root element array<string, mixed>
$xml->getRootAttributes('key'); Value of key attribute of root element mixed
$xml->getVersion(); XML version ?string
$xml->getEncoding(); XML encoding ?string
$xml->isValidXml(); Check if XML is valid bool
$xml->getPath(); Path of XML file ?string
$xml->getFilename(); Filename of XML file ?string
$xml->getConverter(); Converter used to convert XML to array \Kiwilan\XmlReader\XmlConverter
$xml->save('path/to/file.xml'); Save XML file bool
$xml->toArray(); Convert XML to array array<string, mixed>
$xml->__toString(); Convert XML to string string

Advanced methods

Method Description Type Options
$xml->getContents() XML as multidimensional array array<string, mixed>
$xml->find('key') Find key will return first value where that contain key array<string, mixed> strict, content, attributes
$xml->search('key') Search will return all values that contain key mixed
$xml->extract(...keys) Extract metadata key, if not found return null mixed
XmlReader::parseContent(key) Parse content of entry mixed
XmlReader::parseAttributes(key) Parse attributes of entry array<string, mixed> or null

Basic usage

XML as multidimensional array from root (safe).

Basic usage.

Find

Find key will return first value where key that contain title (safe).

Find key will return first value where key is dc:title (safe)

Find key will return first value where key that contain dc:title and return @content (safe)

Find key will return first value where key contain dc:creator and return @attributes (safe)

Search

Search will return all values that contain dc (safe)

Extract

Extract metadata key, if not found return null (safe)

Extract metadata and dc:title keys (safe)

Get content

If you want to extract only @content you could use parseContent() method, if you want to extract only @attributes you could use parseAttributes() method.

Extract dc:title key and return @content (safe)

Extract dc:creator key and return @content (safe)

Extract dc:creator key and return @attributes (safe)

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of php-xml-reader with dependencies

PHP Build Version
Package Version
Requires php Version ^8.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 kiwilan/php-xml-reader contains the following files

Loading the files please wait ....