Download the PHP package webignition/encapsulating-request-resolver-bundle without Composer

On this page you can find all versions of the php package webignition/encapsulating-request-resolver-bundle. 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 encapsulating-request-resolver-bundle

Encapsulating Request Resolver Bundle

Easily inject your own request-encapsulating objects into controller actions.

Tired of injecting the current request into your controller action and then having to poke around in $request->query or $request->request for relevant data?

Ever found yourself wanting to model an inbound request in a more domain-specific manner by encapsulating the current request and calling domain-specific methods to get information about the request?

This helps you do that.

Platform requirements

Installation

Add as a composer dependency

Register bundle (if not using Symfony Flex)

Usage

Any object implementing EncapsulatingRequestInterface can be injected as a controller action argument.

EncapsulatingRequestInterface has a single static create() method into which is passed the current request. You can do whatever you like with the request.

Example User Creation Scenario

Scenario

Consider an API endpoint for creating a user of an application. The endpoint expects a POST request having a payload with email and password fields. A controller will be ultimately responsible for accessing the relevant aspects of the request and making that information available to relevant services.

Without using this bundle

We can inject the current request into the controller action and poke around in the request payload.

This is a very simplified example. In practice we may want to be checking that both $email and $password are not empty.

For more complex requests, validation of the request data prior to processing may be required. It is easy to start to get into territory where request-accessing logic is beyond the responsibilities of the controller.

Even with the more simple of examples, the controller needs to be aware of the shape of the request payload. It could be argued that even this small amount of information is beyond the responsibilities of the controller.

Using this bundle

We can create a custom request class for handling and understanding the data present in a request to create a user. The logic for processing the Symfony request is encapsulated with the custom request class. The custom request class is injected into the controller action.

The more complex or involved your request processing logic is, the more it may make sense to keep that logic under the responsibility of its own class.


All versions of encapsulating-request-resolver-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
symfony/config Version ^6.0
symfony/dependency-injection Version ^6.0
symfony/http-kernel Version ^6.0
symfony/yaml Version ^6.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 webignition/encapsulating-request-resolver-bundle contains the following files

Loading the files please wait ....