PHPackages                             braunstetter/localized-routes - 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. braunstetter/localized-routes

ActiveSymfony-bundle[Localization &amp; i18n](/categories/localization)

braunstetter/localized-routes
=============================

Get your routes localized.

v0.1.2(3y ago)0351MITPHPPHP ^8.0

Since May 17Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Braunstetter/localized-routes)[ Packagist](https://packagist.org/packages/braunstetter/localized-routes)[ RSS](/packages/braunstetter-localized-routes/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

LocalizedRoutesBundle
=====================

[](#localizedroutesbundle)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b55b63cc97e698544154eef7af6d3e39ab1d43c1a782f1423e042c3038ee9351/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f427261756e737465747465722f6c6f63616c697a65642d726f757465732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/Braunstetter/localized-routes/?branch=main)[![Code Coverage](https://camo.githubusercontent.com/b07e089fd149f0f84877d100bb59b6a628302a8d545192e8a0e12af5c0a0710a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f427261756e737465747465722f6c6f63616c697a65642d726f757465732f6261646765732f636f7665726167652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/Braunstetter/localized-routes/?branch=main)[![Build Status](https://camo.githubusercontent.com/d046fbf5cc2f384f89ede19ca8a5f16901a4539ca7b7b71ca4a9924db90e5370/68747470733a2f2f6170702e7472617669732d63692e636f6d2f427261756e737465747465722f6c6f63616c697a65642d726f757465732e7376673f6272616e63683d6d61696e)](https://app.travis-ci.com/Braunstetter/localized-routes)[![Total Downloads](https://camo.githubusercontent.com/38aa59e97d2233a1f42c839c356e8d2f2d22c4428b913aff47aa0a898271549d/687474703a2f2f706f7365722e707567782e6f72672f627261756e737465747465722f6c6f63616c697a65642d726f757465732f646f776e6c6f616473)](https://packagist.org/packages/braunstetter/localized-routes)[![License](https://camo.githubusercontent.com/ff77035567d760f43e4306097578a6d369aff8c5c1498a74c1fcc0366b8cca7e/687474703a2f2f706f7365722e707567782e6f72672f627261756e737465747465722f6c6f63616c697a65642d726f757465732f6c6963656e7365)](https://packagist.org/packages/braunstetter/localized-routes)

This bundle simply redirects your requests to a locale prefixed route.

So `/news` is going to be `/en/news`, if the current language is `en`.

Localized routes are something that has been repeatedly discussed on sites like StackOverflow in the past.

I think it's better to use a well tested bundle for this purpose instead of writing a new listener for each project. This bundle can then be further developed and improved by the community.

Installation
============

[](#installation)

`composer require braunstetter/localized-routes`

Now you can prefix your controller routes:

```
# annotations.yaml
controllers:
  resource: ../../src/Controller/
  type: annotation
  prefix: /{_locale}
```

You're done! Your blank routes are getting redirected to localized ones.

Configuration
=============

[](#configuration)

Since the framework bundle already provides two configuration values (default\_locale, enabled\_locales), we can use this to configure our forwarding process.

```
framework:
  default_locale: en
  enabled_locales: [ 'es', 'en' ]
```

default\_locale
---------------

[](#default_locale)

This is just the fallback locale. If not set, Symfony will try to determine a value based on your system settings. Most likely 'en'.

enabled\_locales
----------------

[](#enabled_locales)

If this value is not specified, then all locales are allowed. If you transfer an array of values here, the selection is restricted accordingly.

Parameters
==========

[](#parameters)

This bundle exposes the `enabled_locales` and `default_locale` configuration values of the framework-bundle as parameters. In addition to this, you also have an `enabled_locales_string` parameter - joining your enabled\_locales e.g.: `de|en|es`

So you can use these locale-specific parameters in your configuration files:

```
# annotations.yaml
controllers:
  resource: ../../src/Controller/
  type: annotation
  prefix: /{_locale}
  requirements:
    _locale: '%enabled_locales_string%'
  defaults:
    _locales: '%default_locale%'
```

> This bundle can certainly be improved. If you have any questions and/or suggestions for improvements, don't hesitate to create a new issue or submit a PR.

Todo
====

[](#todo)

- add attributes to documentation
- add explanation for a language switcher to documentation
- redirect on not supported locale to default locale - like `/es/my_route` when just `de|en` are supported

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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.

###  Release Activity

Cadence

Every ~132 days

Total

3

Last Release

1191d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a0e9d8fa33ff9927391698d8e3cf51c22ec31b396196c1f50614e5a6fe02dd07?d=identicon)[Slowwie](/maintainers/Slowwie)

---

Top Contributors

[![MichaelBrauner](https://avatars.githubusercontent.com/u/4937572?v=4)](https://github.com/MichaelBrauner "MichaelBrauner (11 commits)")

---

Tags

localizationroutingsymfonylocalizationroutingform

### Embed Badge

![Health badge](/badges/braunstetter-localized-routes/health.svg)

```
[![Health](https://phpackages.com/badges/braunstetter-localized-routes/health.svg)](https://phpackages.com/packages/braunstetter-localized-routes)
```

###  Alternatives

[commerceguys/addressing

Addressing library powered by CLDR and Google's address data.

95430.2M43](/packages/commerceguys-addressing)[codezero/laravel-localized-routes

A convenient way to set up, manage and use localized routes in a Laravel app.

543638.1k4](/packages/codezero-laravel-localized-routes)[jms/i18n-routing-bundle

This bundle allows you to create i18n routes.

3635.3M17](/packages/jms-i18n-routing-bundle)[chinleung/laravel-multilingual-routes

A package to register multilingual routes.

442195.4k2](/packages/chinleung-laravel-multilingual-routes)[gettext/languages

gettext languages with plural rules

7530.3M11](/packages/gettext-languages)[elao/form-translation-bundle

Generate translation key for forms

44225.4k1](/packages/elao-form-translation-bundle)

PHPackages © 2026

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