PHPackages                             albertofem/translatableroutepath-bundle - 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. [Localization &amp; i18n](/categories/localization)
4. /
5. albertofem/translatableroutepath-bundle

ActiveLibrary[Localization &amp; i18n](/categories/localization)

albertofem/translatableroutepath-bundle
=======================================

JpnForPhp Symfony2 bundle integration

3491PHP

Since Nov 30Pushed 11y agoCompare

[ Source](https://github.com/albertofem/TranslatableRoutePathBundle)[ Packagist](https://packagist.org/packages/albertofem/translatableroutepath-bundle)[ RSS](/packages/albertofem-translatableroutepath-bundle/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

TranslatableRoutePathBundle
===========================

[](#translatableroutepathbundle)

[![build status](https://camo.githubusercontent.com/e0c0260661110cd803119135e8de77da5b2d64a50852ba1f49bdc8d3c2ed894e/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f616c626572746f66656d2f5472616e736c617461626c65526f7574655061746842756e646c652e706e67)](http://travis-ci.org/albertofem/TranslatableRoutePathBundle) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/847b575275e0bc1b1198a6993b475198585f4f1626ba08fa3c9d34da7462323d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616c626572746f66656d2f5472616e736c617461626c65526f7574655061746842756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f733d61613061333366366137343838363564626131393432346535366266353764663930663938653934)](https://scrutinizer-ci.com/g/albertofem/TranslatableRoutePathBundle/)

Allows using translations in routes paths:

```
/**
 * @Route("/[my.translatable.key]/route/{param}", options={"translatable"=true})
 */
public function myAction()
{
}
```

If `my.transatable.key` is defined in English as: `my_translatable_route`, this will produce a route:

```
/my_translatable_route/route/whatever_param

```

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

[](#installation)

Require it in composer:

```
composer require albertofem/translatableroutepath-bundle dev-master

```

Install it:

```
composer update albertofem/translatableroutepath-bundle

```

Add it to your bundles:

```
$bundles = array(
    ...,
    new \AFM\Bundle\TranslatableRoutePathBundle\AFMTranslatableRoutePathBundle()
);
```

Additionally, you can use this bundle with `JMSI18nRoutingBundle` in which case you will need to register it before this one:

```
$bundles = array(
    ...
    new \JMS\I18nRoutingBundle\JMSI18nRoutingBundle(),
    new \AFM\Bundle\TranslatableRoutePathBundle\AFMTranslatableRoutePathBundle()
);
```

If you need to run the tests:

```
./vendor/bin/phpunit

```

Usage
-----

[](#usage)

You need to add the option to your route to be translatable:

```
/**
 * @Route("/[my.translatable.key]/route/{param}", options={"translatable"=true})
 */
public function myAction()
{
}
```

Using YAML:

```
my_translatable_route:
    path: /[my.translatable.key]/route/{param}
    options: { translatable: true }
```

Use the syntax `[...]` to referer to translations in your routes paths. You can use this syntax in annotations/yaml/PHP indistintively.

### Integration with **JMSI18nRoutingBundle**

[](#integration-with-jmsi18nroutingbundle)

If your are using this great bundle, routes will be automatically translated to all the locales set in the configuration.

### Integration with Symfony core Router

[](#integration-with-symfony-core-router)

When using Symfony core router, all routes are translated into the default locale. If you need a Route to be translated in another language, you must specify the `_locale` default parameter:

```
my_translatable_route:
    path: /[my.translatable.key]/route/{param}
    options: { translatable: true }
    defaults: { _locale: en } # this route will translated in English
```

TODO
----

[](#todo)

- Support parameters for translations (domains, etc.)
- Support transChoice

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community6

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/efe376b93750f4413814c8f96aa1a26d312e981ae58d5356414de7bf93df0005?d=identicon)[albertofem](/maintainers/albertofem)

---

Top Contributors

[![albertofem](https://avatars.githubusercontent.com/u/409472?v=4)](https://github.com/albertofem "albertofem (10 commits)")

### Embed Badge

![Health badge](/badges/albertofem-translatableroutepath-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/albertofem-translatableroutepath-bundle/health.svg)](https://phpackages.com/packages/albertofem-translatableroutepath-bundle)
```

###  Alternatives

[smmoosavi/php-gettext

Wrapper for php-gettext by danilo segan. This library provides PHP functions to read MO files even when gettext is not compiled in or when appropriate locale is not present on the system.

1926.6k1](/packages/smmoosavi-php-gettext)[laradevs/spanish

labels translated to spanish

166.7k](/packages/laradevs-spanish)

PHPackages © 2026

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