Download the PHP
package eliashaeussler/valinor-xml without Composer
On this page you can find all versions of the php package
eliashaeussler/valinor-xml. It is possible to download/install
these versions without Composer. Possible dependencies are resolved
automatically.
Vendor eliashaeussler Package valinor-xml Short Description XML source for cuyz/valinor License
GPL-3.0-or-later
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.
[![Code example](docs/img/header.svg)](#-installation)
# XML source for `cuyz/valinor`
[![Coverage](https://img.shields.io/coverallsCoverage/github/eliashaeussler/valinor-xml?logo=coveralls)](https://coveralls.io/github/eliashaeussler/valinor-xml)
[![Maintainability](https://img.shields.io/codeclimate/maintainability/eliashaeussler/valinor-xml?logo=codeclimate)](https://codeclimate.com/github/eliashaeussler/valinor-xml/maintainability)
[![CGL](https://img.shields.io/github/actions/workflow/status/eliashaeussler/valinor-xml/cgl.yaml?label=cgl&logo=github)](https://github.com/eliashaeussler/valinor-xml/actions/workflows/cgl.yaml)
[![Tests](https://img.shields.io/github/actions/workflow/status/eliashaeussler/valinor-xml/tests.yaml?label=tests&logo=github)](https://github.com/eliashaeussler/valinor-xml/actions/workflows/tests.yaml)
[![Supported PHP Versions](https://img.shields.io/packagist/dependency-v/eliashaeussler/valinor-xml/php?logo=php)](https://packagist.org/packages/eliashaeussler/valinor-xml)
A Composer library that provides an additional XML source for use with
the popular cuyz/valinor library.
This allows to easily map XML files or contents to any signature supported
by Valinor, e.g. objects or special array shapes. It leverages the
mtownsend/xml-to-array
library to convert raw XML to a reusable array structure.
🔥 Installation
⚡ Usage
Given the following XML:
These are the resulting classes:
Mapping from XML string
In order to map the given XML to the Person class, you need
to follow these three steps:
Parse and prepare your XML using the shipped XmlSource
Use the mapper to map your XML to the Person class
The resulting object will look something like this:
Mapping from XML file
The XML can also be read from an external file:
Convert nodes to collections
Sometimes it might be necessary to always convert XML nodes to
collections. Given the following XML:
Let's assume you want to map this XML to the following class:
You will recognize that this does not work as expected when using the
above mapping method:
It will instead throw an exception like this:
This is because the XML converter does not know whether <member> should
be a collection or if it's just a "normal" node. That's why the XmlSource
provides an appropriate method to convert such nodes to collections:
The resulting object will look something like this:
However, this is only relevant if only one node of the collection
exists in your XML. If the XML contains more than one node, the XML
converter properly converts them to a collection:
🧑💻 Contributing
Please have a look at CONTRIBUTING.md.
⭐ License
This project is licensed under GNU General Public License 3.0 (or later).
Requiresphp Version
~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 ext-mbstring Version
* cuyz/valinor Version
^1.3 mtownsend/xml-to-array Version
^2.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 eliashaeussler/valinor-xml contains the following files
Loading the files please wait ....
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.