Download the PHP package nilportugues/api-transformer without Composer
On this page you can find all versions of the php package nilportugues/api-transformer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nilportugues/api-transformer
More information about nilportugues/api-transformer
Files in nilportugues/api-transformer
Package api-transformer
Short Description Base library providing the core functionality for API transformation.
License MIT
Homepage http://nilportugues.com
Informations about the package api-transformer
API Transformer
Purpose
This library provides the core functionality for API transformation and is a base library for many other packages.
By itself it's not usable at all. Check the projects using it below.
Used by
Currently the following transformers make use of this library as foundation:
Installation
Use Composer to install the package:
How it works
Loading must be done using the Mapper
class, as it expects an array containing a defined structure, or a class name implementing ApiMapping
.
There are 2 styles for flexibility when integrating the library into PHP frameworks.
While I discourage having 2 styles for mapping it is well possible to have them side by side in the very same configuration file. The Mapper
class that loads all Mappings does internal transformation for both, so client does not have to worry.
Usage
Creating the Mapping files
Implementing ApiMapping (Prefered method)
To create a Mapping you may implement the following interfaces:
ApiMapping
: transform your data into plain JSON for API consumtion or the JSend API format.JsonApiMapping
to transform your data into the JSONAPI 1.0 standard.HalMapping
to transform your data to HAL+JSON and HAL+XML API standards.
As expected you may implement many interfaces to support multiple API formats.
Mapping using an array
Quality
To run the PHPUnit tests at the command line, go to the tests directory and issue phpunit.
This library attempts to comply with PSR-1, PSR-2, PSR-4 and PSR-7.
If you notice compliance oversights, please send a patch via Pull Request.
Contribute
Contributions to the package are always welcome!
- Report any bugs or issues you find on the issue tracker.
- You can grab the source code at the package's Git repository.
Support
Get in touch with me using one of the following means:
- Emailing me at [email protected]
- Opening an Issue
Authors
License
The code base is licensed under the MIT license.
All versions of api-transformer with dependencies
nilportugues/serializer Version ~1.1
psr/http-message Version ~1.0
zendframework/zend-diactoros Version ^1.1.0