Download the PHP package dittto/symfony-custom-request without Composer

On this page you can find all versions of the php package dittto/symfony-custom-request. 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 symfony-custom-request

Symfony custom requests

What is it?

To help accomplish the "Thin controllers, fat models" ideal, this bundle allows you to create custom request objects that you can use for validating your input before it gets to the controller.

You can use these to make sure certain fields are set with certain dynamic values, or validate form data without having to add additional logic to your controller.

The aim is that your controller knows that it has the correct data and therefore can start working with it immediately, instead of having to double-check it's input is valid.

The new custom request object are defined via services, so can have any other services passed to them. This means your validation steps can use data-sources such as other APIs, databases, Elasticsearch, etc.

How to use it

The first step is to update your composer.json with dittto/symfony-custom-request. You may need to also specify the an entry in the repositories for the github repository.

After you've added and installed this bundle, you'll need to add it to the AppKernel.php file:

Next we'll create our custom request. This is going to be a simple check that looks for a query string containing token=allowed. The test below is stored at AppBundle/Request/TestRequest.php.

Update the services for our new TestRequest. The tag is important as this enables us to know this is a custom request and can be used as a controller parameter.

Lastly, we need to tell our controller to use our custom request using it's parameters.

Filters

There is a filter chain available for altering how this code handles itself after the validate() method has been run. By default there is a filter in place that if a GET request fails, then a 400 exception is thrown.

You can add as many additional filters as you like to the chain to create automated responses based on certain request types.

New filters are added by creating a compatible filter (RequestFilterInterface) and adding a tag of dittto.request_filter when defining it as a service.

To make the filters run in a particular order, add a slot as a tag with a positive integer as it's value. These run in the order of lowest number first. If you assign 2 or more filters to the same slot, the first-assigned filter will take the slot and block any others from taking it's place.

How to override default filters

Slots in local configs seem to always install before vendor-defined configs, so you can use the following to replace the default filter.


All versions of symfony-custom-request 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 dittto/symfony-custom-request contains the following files

Loading the files please wait ....