Download the PHP package iltar/http-bundle without Composer

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

This package is now archived. If you wish to keep using it, please fork it.

http-bundle

Provides extra HTTP related functionality in Symfony.

Requirements:

Recommended installation is via composer: composer require iltar/http-bundle.

Router Enhancements

Let's say we have a ParamConverter on this route that would nicely convert the user parameter of your route to an AppUser, but how would you generate the route for this action? Sadly you still need a scalar as parameter for Router::generate():

Okay, not really a big problem, but we're passing an id to a parameter which you would expect to have an AppUser if you look at the action. Another problem is that if you want to change the argument passed along, you will have to update every single usage of this URL. A decent IDE can get around this issue, but wait! What about your twig templates?

How nice would it be if you could just pass your user object along?

The router decorator is provided to make it easier to resolve arguments required for route generation. They work like a reversed ParamConverter.

A quick Example

You need to do two things to make this work:

And don't forget the service definition.

That's too much work!

This is very nice, but a lot of work. Do I really have to write a resolver for each parameter I want to have resolved? The answer is simple: no. This package comes with two resolvers already.

The first resolver is the IdentifyingValueResolver. This resolver functions as a delegator for models implementing the ModelDescriptorInterface. This resolver will attempt to find the identifying value and obtain it. Currently this package ships with the following descriptors:

The second resolver provided is the MappablePropertyPathResolver. It does two things:

The IdentifyingValueResolver with the EntityIdDescriptor is registered with a priority of 100 by default. The MappablePropertyPathResolver is registered with a priority of 200.

So how can I make it resolve my properties?

It follows three checks:

Without any configuration, the first would attempt to call $user->getUsername() and the second $user->getId().

Aliasing a property

This serves a bit more problematic, as there is no user property within the AppUser. You can work around this issue by defining the mapping in the configuration. This configuration example would call $user->getUsername() if the key user and the object an AppUser.

Wildcards

But my application is a bit messy and I have several different ways of getting the id from a user: user_id, user, id and uid, how do I solve this without writing a lot of configuration? Solution: use the wildcard declaration. The wildcard declaration will make sure that if the AppUser is being passed along, it will always get the id.

But this makes it problematic when I still want to be able to get the username on some pages but the id on the rest, how do I solve this? There's a solution for that as well! Next to a wildcard, you can also specify the username. If a more specific field is configured, it will take that over the wildcard if the name of the parameter matches.

The first line tells that all undefined keys match the id. The second line tells that if they key is user, it should get the username. The third line means that it should pick the parameter name as property name.

Power of the Property Accessor Component

I'm lazy though, what if I want link to the first address of my Client, which has a one to many relation?

Using the IdentifyingValueResolver Alongside the MappablePropertyPathResolver

If you enable the IdentifyingValueResolver, you can already cover the cases where your parameter is the id. When enabled you can can remove the definitions of the mapped_properties where you would refer to the primary key (usually id). The identifier is not limited to id or getId(), the resolver will dynamically attempt to find which field is the primary key. If the id happens to be another entity, it will try to get the id of that given entity until it finds a scalar. It does not support composite primary keys.

To enable the id resolver you have to enable the configuration:


All versions of http-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^5.5||^7.0
symfony/config Version ^2.7||^3.0||^4.0
symfony/dependency-injection Version ^2.7||^3.0||^4.0
symfony/framework-bundle Version ^2.7||^3.0||^4.0
symfony/http-kernel Version ^2.7||^3.0||^4.0
symfony/property-access Version ^2.7||^3.0||^4.0
symfony/routing Version ^2.7||^3.0||^4.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 iltar/http-bundle contains the following files

Loading the files please wait ....