Download the PHP package bitexpert/adroit without Composer

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

bitexpert/adroit

This package provides a PSR-7 compatible ADR middleware.

Build Status Coverage Status

Installation

The preferred way of installing bitexpert/adroit is through Composer. Simply add bitexpert/adroit as a dependency:

Usage

The configure the \bitExpert\Adroit\AdroitMiddleware middleware you need provide an array of \bitExpert\Adroit\Action\Resolver\ActionResolver, an array of \bitExpert\Adroit\Responder\Resolver\ResponderResolver and a action request attribute telling adroit where to look for the action identifier.

ActionResolver

As the name implies ActionResolvers are responsible for resolving an action class instance from the so-called actionToken. The actionToken is basically used to identify a route. Adroit comes with a default implementation of an ActionResolver which uses any container-interop compatible DI container as a backend.

Of course you may implement your own ActionResolvers using the (\bitExpert\Adroit\Action\ActionResolver) interface.

ResponderResolver

Similar to the ActionResolvers the ResponderResolvers are responsible for resolving an responder class instance from the $type defined in the DomainPayload instance. Adroit comes with a default implementation of an ResponderResolver (\bitExpert\Adroit\Responder\Resolver\ContainerAwareResponderResolver) which uses any container-interop compatible DI container as a backend.

Of course you may implement your own ResponderResolvers using the ResponderResolver interface.

(Domain)Payload

You may define your own payload class(es) by implementing the \bitExpert\Adroit\Domain\Payload interface. This gives you the opportunity to freely define the payload according to your needs. This example implementation will be used in the documentation as follows:

Actions

In case you want to implement your own action logic (who does not want that?) you may use any callable following the signature of the Action interface or create your own Action class and implement the interface.

Action classes are allowed to either return an object which implements the Payload interface or an PSR-7 response object implementing the \Psr\Http\Message\ResponseInterface interface. By default you should aim to return a Payload object. The PSR-7 response might come in handy when you have to deal with file downloads where you most likely not want to read the file in your action class, push the content to the responder just to to write it to the response message body.

Responders

Responders have to return a PSR-7 response object. Responders are not forced to implement the Responder interface so you may use Closures as well but implementing the interface is recommended:

Usage

Since Adroit provides a handy set of middlewares to achieve ADR you simply have to configure your ActionResolver(s) and ResponderResolver(s). For the following example we use the ArrayContainer of bitexpert/specialist which are configured using an array of mappings between the action identifier and the action and the domain payload type to the appropriate responder:

As you can see, you also may use simple callables as actions and responders.

Adroit itself does not depend on a concrete PSR-7 implementation which means you should be able to use it in your set-up without running into problems. Just for the unit tests Adroit depends on zendframework/zend-diactoros as a PSR-7 implementation.

Middleware hooks

Adroit provides several hooks to be as flexible as a standard middleware pipe while implementing the ADR paradigm.

You may use the following hooks to manipulate things in between the execution of the middlewares needed for ADR itself:

These hooks allow great flexibility but with great flexibility also comes great responsibility ;-) Please note that the hooks are named "before" and so are to implement the middlewares:

Of course you may implement it different, but that would not hit the "before" in the hook name. Please be aware of that!

Routing

To avoid external dependencies we removed routing from Adroit since this may be achieved by using any routing mechanism you like. You just need to ensure that action identifying value will be set to a request attribute of your choice and tell the ActionMiddleware where to look for it.

License

Adroit is released under the Apache 2.0 license.


All versions of adroit with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
psr/http-message Version ^1.0
psr/container Version ^1.0
zendframework/zend-stratigility Version ^1.3.0
bitexpert/slf4psrlog Version ^0.1.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 bitexpert/adroit contains the following files

Loading the files please wait ....