Download the PHP package dreadlabs/media-type-decoding without Composer

On this page you can find all versions of the php package dreadlabs/media-type-decoding. 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 media-type-decoding

dreadlabs/media-type-decoding

Description

This library provides a simple API for Media type decoding.

It can be used to infer PHP class names from Media type strings literals such as application/prs.acme.user-created+json; version=1.0.

This library leans on the RFC 6838 specification.

It is a companion to DreadLabs/media-type-encoding, providing decoding of a Media type string literal.

Installation

composer install dreadlabs/media-type-decoding:~1.0

Usage

Example 1

From a Media type string literal within the Application top-level type and the Vendor subtype tree, I want to resolve a fully-qualified PHP class name. The Media type string literal also carries a version parameter and no Suffix is defined.

$mediaType = new Application(RegistrationTree::vendor(new UpperCamelCasedFromHyphened(new Imploded('\\'))));
$withParameter = $mediaType->withParameter(new Parameter('version'));
$withSuffix = $withParameter->withSuffix(Suffix::none());

echo (string)$withSuffix->inferred('application/vnd.acme.customer-api.domain.event.item-added-to-cart; version=1.0');

> 'Acme\\CustomerApi\\Domain\\Event\\ItemAddedToCart'

Example 2

This example enhances Example 1. The Media type string literal does not carry all necessary data to get the fully-qualified PHP class name. So we make usage of the Prefixed subtype inference.

$prefix = ['acme', 'customer-api', 'domain'];
$subtype = new Prefixed(new UpperCamelCasedFromHyphened(new Imploded('\\')), $prefix);
$mediaType = new Application(RegistrationTree::personal($subtype));

echo (string)$mediaType->inferred('application/prs.event.item-removed-from-cart')

> 'Acme\\CustomerApi\\Domain\\Event\\ItemRemovedFromCart'

Development

Requirements

Please read the contribution guide and ensure you have a working Docker environment.

Setup

Fork and clone this repository as described in the contribution guide.

Open a terminal and run the setup script:

script/setup

Run tests

script/console run composer test:unit
script/console run composer test:integration
script/console run composer test:acceptance:fail-fast

Links

License

MIT


All versions of media-type-decoding with dependencies

PHP Build Version
Package Version
No informations.
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 dreadlabs/media-type-decoding contains the following files

Loading the files please wait ....