Download the PHP package lmc/cqrs-http without Composer

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

LMC CQRS Http extension

cqrs-types Latest Stable Version Tests and linting Coverage Status

A library containing base implementations to help with Http Queries and Commands. This library is an extension for CQRS/Bundle and adds support for PSR-7.

Table of contents

Installation

NOTE: You will also need an implementation for PSR-7, PSR-17 and PSR-18 for HTTP extensions to work.

Query

Query is a request which fetch a data without changing anything. See more here

AbstractHttpQuery

A base HTTP Query, it abstracts a creating of a Psr\Http\Message\RequestInterface (PSR-7) using a Psr\Http\Message\RequestFactoryInterface (PSR-17) (it is directly required to be injected into a query).

It also implements a ProfileableInterface feature.

Method Type Description
getRequestType final It declares a request type of a Http query to be a Psr\Http\Message\RequestInterface
getHttpMethod abstract It requires a query to return a http method of a query. (see PSR Http Message Util)
getUri abstract This method returns a URI of the Query - it may be just a string or a Psr\Http\Message\UriInterface (PSR-7) instance.
modifyRequest base If you overwrite this method, you can manipulate a RequestInterface instance.
getProfilerId base It's a predefined creating of profiler id for a http query. It creates a profiler id based on http method and uri.
getProfilerData base If you overwrite this method, you can specify additional profiler data. Default is null (no data).
__toString base It's a predefined casting a Query into string, it returns a string representation of uri.

AbstractHttpGetQuery

A base HTTP GET Query, it abstracts a creating of a Psr\Http\Message\RequestInterface (PSR-7) using a Psr\Http\Message\RequestFactoryInterface (PSR-17) (it is directly required to be injected into a query).

It extends a base AbstractHttpQuery and predefine some abstract methods. It also adds CacheableInterface feature, since a GET request is mostly cacheable

Method Type Description
getHttpMethod final It declares a http method of this query to be GET.
getUri abstract This method returns a URI of the Query - it may be just a string or a Psr\Http\Message\UriInterface (PSR-7) instance.
getCacheTime base It returns a default value for a cache time of 30 minutes.
getCacheKey base It creates a CacheKey out of a static class name (your implementation class name) and a uri, which should create a unique enough cache key for most queries.

TIP: If you want to use this implementation but don't need a cache, you can simply return a CacheTime::noCache() in your implementation of getCacheTime method.

Query Handlers

It is responsible for handling a specific Query request and passing a result into OnSuccess callback. See more here.

Http Query Handler

This handler supports Psr\Http\Message\RequestInterface and handles it into Psr\Http\Message\ResponseInterface.

It also checks a status code of a response and marks it as error if it is an error code:


Command

Command is a request which change a data and may return result data. See more here

AbstractHttpCommand

A base HTTP Command, it abstracts a creating of a Psr\Http\Message\RequestInterface (PSR-7) using a Psr\Http\Message\RequestFactoryInterface (PSR-17) (it is directly required to be injected into a command).

It also implements a ProfileableInterface feature.

Method Type Description
getRequestType final It declares a request type of a Http command to be a Psr\Http\Message\RequestInterface
getHttpMethod abstract It requires a command to return a http method of a command. (see PSR Http Message Util)
getUri abstract This method returns a URI of the Command - it may be just a string or a Psr\Http\Message\UriInterface (PSR-7) instance.
modifyRequest base If you overwrite this method, you can manipulate a RequestInterface instance.
getProfilerId base It's a predefined creating of profiler id for a http command. It creates a profiler id based on http method and uri.
getProfilerData base If you overwrite this method, you can specify additional profiler data. Default is null (no data).
__toString base It's a predefined casting a Command into string, it returns a string representation of uri.

AbstractHttpDeleteCommand

A base HTTP DELETE Command, it abstracts a creating of a Psr\Http\Message\RequestInterface (PSR-7) using a Psr\Http\Message\RequestFactoryInterface (PSR-17) (it is directly required to be injected into a command).

It extends a base AbstractHttpCommand and predefine some abstract methods.

Method Type Description
getHttpMethod final It declares a http method of this query to be DELETE.

AbstractHttpPatchCommand

A base HTTP PATCH Command, it abstracts a creating of a Psr\Http\Message\RequestInterface (PSR-7) using a Psr\Http\Message\RequestFactoryInterface (PSR-17) (it is directly required to be injected into a command).

It extends a base AbstractHttpCommand and predefine some abstract methods.

Method Type Description
getHttpMethod final It declares a http method of this query to be PATCH.

AbstractHttpPostCommand

A base HTTP POST Command, it abstracts a creating of a Psr\Http\Message\RequestInterface (PSR-7) using a Psr\Http\Message\RequestFactoryInterface (PSR-17) (it is directly required to be injected into a command).

It extends a base AbstractHttpCommand and predefine some abstract methods.

Method Type Description
getHttpMethod final It declares a http method of this query to be POST.
createBody abstract It requires a command to return an instance of Psr\Http\Message\StreamInterface which is used as a POST request body.
createRequest base It creates a request with a body.
getProfilerData base It adds a Body into additional data for profiler, so it may be shown later in profiler.

AbstractHttpPutCommand

A base HTTP PATCH Command, it abstracts a creating of a Psr\Http\Message\RequestInterface (PSR-7) using a Psr\Http\Message\RequestFactoryInterface (PSR-17) (it is directly required to be injected into a command).

It extends a base AbstractHttpCommand and predefine some abstract methods.

Method Type Description
getHttpMethod final It declares a http method of this query to be PATCH.

Send Command Handlers

It is responsible for handling a specific Command request and passing a result into OnSuccess callback. See more here.

Http Send Command Handler

This handler supports Psr\Http\Message\RequestInterface and handles it into Psr\Http\Message\ResponseInterface.

It also checks a status code of a response and marks it as error if it is an error code:


Response Decoders

It is meant to decode a response (a result of either QueryHandlerInterface or a SendCommandHandlerInterface). See more here.

HttpMessageResponseDecoder

It decodes a Psr\Http\Message\ResponseInterface into a Psr\Http\Message\StreamInterface by getting a body of a response.

StreamResponseDecoder

It decodes a Psr\Http\Message\StreamInterface into a string by getting a stream contents (if possible).

Note: There is also a JsonResponseDecoder which decodes a string into an array.

Profiler Formatters

HttpProfilerFormatter

It formats a Psr\Http\Message\MessageInterface and Psr\Http\Message\StreamInterface into a readable format, so a data is nicer in profiler.


All versions of cqrs-http with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
ext-mbstring Version *
fig/http-message-util Version ^1.1
lmc/cqrs-types Version ^3.2
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.0 || ^2.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 lmc/cqrs-http contains the following files

Loading the files please wait ....