Download the PHP package aeris/zend-rest-module without Composer

On this page you can find all versions of the php package aeris/zend-rest-module. 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 zend-rest-module

ZendRestModule

A Zend Framework 2 module to help you create RESTful web services.


Installation

ZendRestModule can be installed via composer.

Then add 'Aeris\ZendRestModule' to the 'modules' config in /config/application.config.php.

Features

ZendRestModule provides a number of features to facilitate creating a RESTful web service.

Serializer

ZendRestModule uses the popular JMS Serializer to serialize and deserialize application models.

The JMS Serializer allows you to use Annotations, XML, or YML to configure how objects are serialized and deserialized from raw data.

While you can use the JMS serializer on its own, ZendRestModule introduces behaviors to make serialization/deserialization a lot easier in the context of Zend APIs.

Here's how a RESTful controller might look without the ZendRestModule:

Automatic Enitity Serialization

Using the ZendRestModule, you can simply return the raw model:

The ZendRestModule will intercept the return value, convert the model to a SerializedJsonModel, then serialize the data according to your JMS Serializer configuration.

Deserialize onto Existing Entities

Out of the box, the JMS Serializer allows you to deserialize raw data into entity objects.

ZendRestModule includes a JMS object constructor extension, which allows you to deserialize data onto an existing entity. This is very useful for PUT requests, where the request data my not be a fully defined entity.

See this article for a long rant about how and why this works.

Serialization Groups

The JMS Serializer allows you to configure serialization groups for entities. This is useful for setting what data different request return. For example, I may only want to see an animal's id and name in a getList response, but see more details in a get response:

The Aeris\ZendRestModule\View\Annotation\Groups annotation allows you to configure which serialization groups will be used for each controller action.

You can also configure serialization groups in the zend_rest config:

Other Serializer Components

DateTimeTimestampHandler

Serializes/deserializes between unix timestamps and \DateTime objects.

The serializer will now deserialize birthDate timestamps into \DateTime objects, and serialize birthDate as a timestamp.

Serializer Configuration Reference

RESTful Exception Handling

ZendRestModule catches errors and exceptions thrown during the MVC event cycle, and converts the errors into JSON responses.

Example

This example configures JSON output for errors occuring in the Animals Web Service.

A GET request to /animals/narwhal would return a JSON object so:

The error would also be written to the server log, by way of the on_error callback.

Similarly a request to /not/an/endpoint would return a 404 error, with a invalid_request JSON application code.

AbstractTestCase

The \Aeris\ZendRestModuleTest\AbstractTestCase is an extension of the \Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase. It provides a few utilities for testing restful APIs, and a number of new assertions. It is not necessary to use this test case class when working with the ZendRestModule.

Configuration Reference

Have fun!


All versions of zend-rest-module with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
zendframework/zendframework Version 2.3.*
doctrine/common Version ~2.3
jms/serializer Version ~0.16.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 aeris/zend-rest-module contains the following files

Loading the files please wait ....