PHPackages                             axis/axis-s2-routing-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. axis/axis-s2-routing-plugin

AbandonedArchivedSymfony1-plugin[Framework](/categories/framework)

axis/axis-s2-routing-plugin
===========================

symfony 1.x plugin that integrates Symfony2 routing component into your application

06[1 issues](https://github.com/e1himself/axis-s2-routing-plugin/issues)PHP

Since Dec 16Pushed 13y ago1 watchersCompare

[ Source](https://github.com/e1himself/axis-s2-routing-plugin)[ Packagist](https://packagist.org/packages/axis/axis-s2-routing-plugin)[ RSS](/packages/axis-axis-s2-routing-plugin/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

AxisS2RoutingPlugin
===================

[](#axiss2routingplugin)

symfony 1.x plugin that integrates Symfony2 routing component into your application.

It is kinda failed try to bring Symfony2 routes into symfony1. But `sfPatternRouting` class is way too deeply interwoven into symfony1 that it is practically impossible to replace it with another routing implementation.

See [AxisCurlyRoutingPlugin](https://github.com/e1himself/axis-curly-routing-plugin). It uses Symfony2 routing system on a lower level (without replaceing sfPatternRouting but just introducing new route class).

Installation
------------

[](#installation)

Use [Composer](http://getcomposer.org/). Just add this dependency to your `composer.json`:

```
  "require": {
    "axis/axis-s2-routing-plugin": "dev-master"
  }
```

Configuration
-------------

[](#configuration)

First, you should replace standard `routing.yml` config handler with the new one. Add this to your `config_handlers.yml`:

```
config/routing.yml:
  class:    \Axis\S1\S2Routing\Config\ConfigHandler
  file:     %SF_PLUGINS_DIR%/AxisS2RoutingPlugin/lib/Axis/S1/S2Routing/Config/ConfigHandler.php
```

Than replace symfony's default `sfPatternRouting` with the plugin's routing class by adding this to your `factories.yml`:

```
all:
  routing:
    class: \Axis\S1\S2Routing\Routing
    param:
      router: @axis.s2routing.router
      generate_shortest_url:            true
      extra_parameters_as_query_string: true
```

Usage
-----

[](#usage)

Now you can define routes in `routing.yml` files using new [Symfony2 Routing Component](https://github.com/symfony/Routing) syntax along with the old routes. Just define `sf2Route` as route class and it's all.

```
s2_hello: # Symfony2 route
  class: sf2Route
  url:   '/s2/{name}'
  param: { module: test, action: hello }

s1_hello: # symfony1 route
  url:   '/s1/:name'
  param: { module: test, action: hello }
```

Important notes
---------------

[](#important-notes)

- `sfActions::getRoute()` will return `sf2Route` class for new S2 routes and `sfRoute` (or subclass) instances for the old ones as it was before. *Be careful*: `sf2Route` is not compatible with symfony1 `sfRoute` instances.
- This is plugin is not compatible with [AxisModuleRoutingPlugin](https://github.com/e1himself/axis-module-routing-plugin)at the moment. But I'm working on that.
- There is no support of collection and object routes for S2 routes for now.

Advantages
----------

[](#advantages)

So why is this for?

Symfony1 routing system went out of date. The main problem is that it strictly constrains how your routes should look like and what you can use as variable value.

### Powerful caching

[](#powerful-caching)

`S2RoutingPlugin` brings powerful Symfony2 routing cache to your project.

### Hierarchical URLs

[](#hierarchical-urls)

The trigger reason of integrating S2 Routing was the ability to use *path variables* in routes. For example you want to use something like hierarchical structure in your urls:

You could do this with default symfony1 routing:

```
asset:
  url: /:path/:filename.:sf_format
  param: { ... }
  requirements:
    path: .*
```

This works well routing requests from `/my/assets/path/image.png` to defined controller but when you need to generate url for that path you'll get this: `/my%2Fassets%2Fpath/image.png`.

Yeah, the custom coded Route class could handle that. But S2 Routing does this out of the box:

```
asset:
  url: /{path}/{filename}.{sf_format}
  param: { ... }
  class: sf2Route
  requirements:
    path: .*
```

And there is many other handy features you can use.

### Variables delimited by any symbols

[](#variables-delimited-by-any-symbols)

```
blog_post:
  url: /blog/{slug}-{id}.html # you cannot use path like '/blog/:slug-:id.html' using symfony1 routing
  param: { ... }
  class: sf2Route
  requirements:
    slug: .+
    id:   \d+
```

### Scheme requirement

[](#scheme-requirement)

```
login:
  url:  /login
  param: { ... }
  class: sfRoute
  requirements:
    _scheme: https
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d24c797f078b59b84f555eb4ac8b468424e3b29740180a4abb5ca5bc51e27f5?d=identicon)[7heaven](/maintainers/7heaven)

---

Top Contributors

[![e1himself](https://avatars.githubusercontent.com/u/370680?v=4)](https://github.com/e1himself "e1himself (9 commits)")

### Embed Badge

![Health badge](/badges/axis-axis-s2-routing-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/axis-axis-s2-routing-plugin/health.svg)](https://phpackages.com/packages/axis-axis-s2-routing-plugin)
```

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
