Download the PHP package wjb/rewire-bundle without Composer

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

SensioLabsInsight

Use objects to generate routes

Let's say you have a blog application with route like this:

then your templates will have this:

For this simple case, ParamConverter is automatically applied.

The problem

Now imagine you want to change it to use {slug} instead of {id} in your URL. Updating controller is simple, but updating all the templates is not so.

The solution

This bundle acts as ReverseParamConverter. Check this example:

and the template:

Now instead of new_post.id you can use object itself and this bundle will use it to generate {id} needed for route.

So if you want to slug instead of id in your route, just update your controller:

and that's all, template doesn't require any changes.

Note

If you install this bundle, you don't have to change all your templates immediatelly. So both these combinations would still work:

Complex routes

The above example is pretty simple so let's try something more complex. For this, imagine we wanted to add {category_slug} to URL for better SEO.

The old way:

For this fictional blog application, generated route would be something like /conspiracy-theories/why-they-suck. You can see why updating templates can be a problem.

With this bundle:

your template doesn't require any changes, it would remain the same:

Usage

The @RewireParams annotation has 2 properties:

Perfomance

While there is perfomance hit, I didn't notice any on page with 106 routes (largest I have). It is probably too small to spot it but more testing is needed.

Program works by caching @RewireParams annotations and later using it in Router decorator class. Given this bundle is built in a day, I am sure improvements can be made.

Installation

composer require wjb/rewire-bundle

If you are on Symfony4, you don't have to do anything else. For Symfony3, enable the bundle in your AppKernel:

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            ...
            new wjb\RewireBundle\wjbRewireBundle(),
            ...

All versions of rewire-bundle with dependencies

PHP Build Version
Package Version
Requires symfony/framework-bundle Version ~3.2|~4.0
symfony/property-access Version ~3.2|~4.0
doctrine/annotations Version ^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 wjb/rewire-bundle contains the following files

Loading the files please wait ....