Download the PHP package zenstruck/object-routing-bundle without Composer

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

ZenstruckObjectRoutingBundle

Build Status Scrutinizer Code Quality Code Coverage SensioLabs Insight StyleCI Latest Stable Version License

A Symfony Bundle that enables passing objects to your router. It works by decorating the default router with a custom ObjectRouter that transforms objects into a route name and route parameters. These are passed to the default router.

For those that remember symfony 1, this bundle brings back functionality that was available in that framework.

Installation

  1. Install with composer:

    composer require zenstruck/object-routing-bundle
  2. Enable the bundle in the kernel:

Usage

To use this bundle, you must first have an object. Let's use a BlogPost example:

Next, you must have some routes for that object:

Without this bundle

Now, suppose you want to generate a route for a blog post. The standard way of doing this is as follows:

Twig:

Symfony Controller:

With this bundle

In this bundle's config, setup a mapping of BlogPost to the blog post routes:

Generating routes for a blog post is now much simpler:

Twig:

Symfony Controller:

Custom Transformations

This bundle comes with a ClassMapObjectTransformer that uses the bundle's config to map object classes to routes. If you have a more complex scenario, you can add your own transformers. Simply have your custom transformer implement Zenstruck\ObjectRoutingBundle\ObjectTransformer\ObjectTransformer and register it as a service tagged with zenstruck_object_routing.object_transformer.

See Zenstruck\ObjectRoutingBundle\ObjectTransformer\ClassMapObjectTransformer for a reference.

Full Default Config

NOTE 1: This bundle's router uses the PropertyAccess component to access the object's properties/methods.

NOTE 2: When mapping multiple objects that inherit one another, be sure to order them from child to parent. For instance, if you had a BlogPost that has a parent class of Page and both are mapped, be sure to put BlogPost before Page.


All versions of object-routing-bundle with dependencies

PHP Build Version
Package Version
Requires symfony/http-kernel Version ~2.3|~3.0
symfony/routing Version ~2.3|~3.0
symfony/property-access Version ~2.3|~3.0
symfony/dependency-injection Version ~2.3|~3.0
symfony/config Version ~2.3|~3.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 zenstruck/object-routing-bundle contains the following files

Loading the files please wait ....