Download the PHP package kleijnweb/php-api-descriptions without Composer

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

This project is no longer maintained

KleijnWeb\PhpApi\Descriptions

Build Status Coverage Status Scrutinizer Code Quality Latest Stable Version

A PHP library for creating "contract-first" API applications.

Supported formats:

Limited:

RAML is much more feature-rich and generally elaborate standard than OpenAPI, it will take some time to support the full set. Help is appreciated.*

The aim is to provide full support and interchangeability.

Typical Usage

Validating Requests And Responses

Namespaces omitted for brevity:

If you're feeling frisky and want to try RAML support:

(De-)Hydration

NULLs, Undefined And Defaults

The processor will assume hydration input is pre-validated. This implies that when an input object contains a property with a NULL value, it will leave it as is, and it may be casted to something other than NULL if the input is invalid (otherwise it will be "hydrated" by NullProcessor). When dehydrating, the processors will intentionally not try to force validity of anything that may have been set to an invalid value by application processing.

The implied flow is thus: input > deserialization > validation > hydration > business logic > dehydration [> validation] > serialization > output .

When adhering to this flow, the behavior should be intuitive. There is a separate document detailing the implementation here.

DateTime

The expected in- and output format can be tweaked by configuring the DateTimeProcessor factory with a custom instance of DateTimeSerializer (via the builder):

By default output is formatted as 'Y-m-d\TH:i:s.uP' (RFC3339 with microseconds). When passed, the first constructor argument will be used instead. Input parsing is attempted as follows:

  1. Arguments to the constructor
  2. RFC3339 with decreasing precision:
    1. RFC3339 with microseconds
    2. RFC3339 with milliseconds
    3. RFC3339
  3. ISO8601

NOTE: Formats not starting with Y-m-d do not work with Schema::FORMAT_DATE nor AnyProcessor.

Custom Processors

Class name resolution and DateTime handling can be tweaked by injecting custom instances into the builder, but pretty much all parts of the hydration and dehydration processes are customizable. You can inject custom processors by injecting factories for them into the "processor factory queue". All of the processors and their factories are open for extension. Use cases include:

Some examples can be found here.

Performance Expectations

On my old Xeon W3570, both hydration and deydration of a an array of 1000 realistic objects (nested objects, arrays) takes about 100ms; on average a little short of 1ms per root object.

Integration

If you want OpenAPI support in combination with Symfony, you should check out SwaggerBundle.

And there's PSR-7/PSR-15 Middleware, which behaves pretty much the same but is much more reusable.

Limitations

Contributing

Pull requests are very welcome, but the code has to be PSR2 compliant, follow used conventions concerning parameter and return type declarations, and the coverage can not go down.

License

KleijnWeb\PhpApi\Descriptions is made available under the terms of the LGPL, version 3.0.


All versions of php-api-descriptions with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0.0
justinrainbow/json-schema Version ^2.0
psr/http-message Version 1.0
symfony/yaml Version >=2.8.7
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 kleijnweb/php-api-descriptions contains the following files

Loading the files please wait ....