Download the PHP package psx/data without Composer

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

Data

Data processing library which helps to read and write data to and from POPOs in different formats.

Usage

The following example showcases how you could read/write a complex model.

Formats

The library supports different reader and writer classes to produce different data formats. If you want to read a specific format you can provide the content type of the data. I.e. if you want read XML you could use the following payload:

The processor uses a reader factory to obtain the fitting reader for a specific content type. In this case it would use the XML reader. The reader factory can be easily extended with different reader classes to support other data formats.

In order to produce a payload from an incoming HTTP request you simply have to set the body as data and the content type from the header. How you access this data depends on the HTTP interface. For an PSR-7 request you could use:

On the other hand if you want to write data as response you would use:

The writer factory can also be extended with custom writer implementations.

Constraints

It is also possible to add specific constraints to your model class. In the following some examples:

All available attributes are located at the psx/schema project.

Transformations

Each reader class returns the data in a form which can be easily processed. I.e. the json reader returns a stdClass produced by json_decode and the xml reader returns a DOMDocument. To unify the output we use transformation classes which take the output of a reader and return a normalized format. I.e. for xml content we apply by default the XmlArray transformer which transforms the DOMDocument. So you can use a transformer if you directly want to work with the output of the reader.

In case you want to validate incoming XML data after a XSD schema you could use the XmlValidator transformer:

Exporter

If you write data you can set as payload an arbitrary object. We use an exporter class to return the actual data representation of that object. By default the exporter reads also the psx/schema attributes so you can use the same model for incoming and outgoing data. But it is also possible to use different classes. I.e. you could create model classes using the psx/schema attributes only for incoming data and for outgoing data you could use the JMS exporter in case you have already objects which have these annotations.

If you have another way how to extract data of an object (i.e. a toArray method which returns the available fields of the object) you can easily write a custom exporter.


All versions of data with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
ext-dom Version *
psx/datetime Version ^3.0
psx/http Version ^4.0
psx/json Version ^3.0
psx/model Version ^5.0
psx/record Version ^3.0
psx/schema Version ^7.0
psx/validate 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 psx/data contains the following files

Loading the files please wait ....