Download the PHP package rollerworks/route-autowiring-bundle without Composer

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

Rollerworks RouteAutowiringBundle

The RollerworksRouteAutowiringBundle allows to import multiple route collections using an autowiring system.

For example you have BundleA which defines some routes, to use them you need to explicitly import them, but if you remove/disable the bundle the application breaks because it can't find the resource files anymore.

When you automatically enable them you can't keep the prefix consistent. And sometimes you rather don't want to enable all route collections.

How does it work?

In practice you define your routes as normal, but instead of importing them from a file or service you load them using the autowiring system.

Requirements

You need at least PHP 7.2 and the Symfony FrameworkBundle.

Installation

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Basic usage

There are two parts to this bundle, registering and loading.

Routing schema's are kept per "routing-slot", which are automatically registered whenever you import a route collection.

Registering routes for loading

Say you have an AcmeShopBundle with the following route collections:

You can import them using the following snippet:

The @AcmeShopBundle/Resources/config/routing/frontend.yml resource will be imported (or registered) in the 'frontend' routing-slot. And the @AcmeShopBundle/Resources/config/routing/backend.yml resource will be imported in the 'backend' routing slot.

Note:

Route resources follow the same logic as the Symfony routing system, @AcmeShopBundle resolves the to full path of the AcmeShopBundle.

See also: Including External Routing Resources

Tip: You can import multiple routing resources per slot :+1:

The import will try to guess the correct resource-type, but for special ones (like a service) you need to provide the type in the third parameter:

Import multiple resources to the same slot? Provide a default (for the current instance):

Resource tracking

The routing system is not directly aware of any related classes when registering your route imports (using the RouteImporter). Therefor removing a Bundle or changing configuration may not directly reload your routing schema (unless you use the cache:clear command).

You need to register the Extension class and any other related class, like your Bundle's Configuration class, if changing them may cause a different routing import schema.

To register an object (like the Extension class, and its parent(s)) use:

$routeImporter->addObjectResource($this);

Or to register a class (and its parent(s)):

$routeImporter->addObjectClass($this);

To register any Symfony supported Resource (full path) use:

$routeImporter->addResource(new FileResource('my-file-file-path.yml'));

Note:

Resources are only tracked when debugging is enabled.

Imported routes (->import(...)) are automatically tracked by the routing system, only classes related to the import registering should be registered for tracking.

Loading registered routes

Ones your routes are imported into there routing-slot's it's time to load them into the application's routing schema.

Normally you would use something like this:

But instead you load them using the autowiring loader:

That's it! All the routes that were imported in the 'frontend' and 'backend' slots are now loaded into the applications routing schema.

But wait, what if there are no routes imported for the slot?

Then nothing happens, this bundle is designed to make configuration easy. When there are no routes imported for the slot it simple returns an empty Collection, which in practice is never used.

Third-party import example

As the Symfony routing system allows to load any route resource from a routing file you can actually load a routing-slot from within from another routing-slot.

Say you want to allow others to "extend" your bundle's routing schema:

First import the main parts in the application's routing file:

In AcmeShopBundle define the following routes, and import them (extension snippet omitted).

Others can now easily import there routing schema(s) into the acme_shop.frontend routing-slot.

Versioning

For transparency and insight into the release cycle, and for striving to maintain backward compatibility, this package is maintained under the Semantic Versioning guidelines as much as possible.

Releases will be numbered with the following format:

<major>.<minor>.<patch>

And constructed with the following guidelines:

For more information on SemVer, please visit http://semver.org/.

License

The package is provided under the MIT license.


All versions of route-autowiring-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
symfony/framework-bundle Version ^5.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 rollerworks/route-autowiring-bundle contains the following files

Loading the files please wait ....