PHPackages                             aw-studio/laravel-translatable-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. aw-studio/laravel-translatable-routes

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

aw-studio/laravel-translatable-routes
=====================================

12.6kPHP

Since Oct 5Pushed 4y ago1 watchersCompare

[ Source](https://github.com/aw-studio/laravel-translatable-routes)[ Packagist](https://packagist.org/packages/aw-studio/laravel-translatable-routes)[ RSS](/packages/aw-studio-laravel-translatable-routes/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Translatable Routes
===========================

[](#laravel-translatable-routes)

A package for creating and managing translatable routes in laravel.

Setup
-----

[](#setup)

Install the package via composer:

```
composer require aw-studio/laravel-translatable-routes
```

Usage
-----

[](#usage)

Build translated routes in the form of `/en/home`, `/de/startseite` made easy.

Make sure to translate your routes within your translation-files in the `resources` directory, for example:

```
// lang/de/routes.php

return [
    'home' => 'startseite'
];
```

You can now simply add translated Routes to your preferred routes file using the `__()` helper in the uri string like this:

```
Route::trans('/__(routes.home)', 'HomeController@show')->name('home');
```

A translated route will be created for all locales defined in your `translatable` config. The locale will be prepended to the given **uri** and **name**. So the routes for the previous example would be:

- `en.home` =&gt; `/en/home`
- `de.home` =&gt; `/de/startseite`

The `__route` helper prepends the current locale to the given name and returns the corresponding route:

```

    ...

```

### Switching Languages

[](#switching-languages)

You may want to place a link to the different language route on your website. To do this, the `translate` method can be applied to the current route with the desired locale.

```
Deutsch
```

#### With Parameters

[](#with-parameters)

For routes with parameters a translator must be specified. A translator is a controller method that returns the route parameters for the desired locale. The translator method receives the desired locale and the parameters for the current locale.

```
// ./routes/web.php
Route::trans('/{slug}', 'PostController@show')->translator('getSlug')->name('home');

// ./app/Http/Controllers/PostController.php

class PostController extends Controller
{
	// ...

	public function getSlug($locale, $slug)
	{
		$slug = Post::whereTranslation('slug', $slug)
			->first()
			->translate($locale)
			->slug;

		return ['slug' => $slug];
	}
}
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 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://avatars.githubusercontent.com/u/29352871?v=4)[Lennart Carstens-Behrens](/maintainers/cbl)[@cbl](https://github.com/cbl)

---

Top Contributors

[![cbl](https://avatars.githubusercontent.com/u/29352871?v=4)](https://github.com/cbl "cbl (14 commits)")

### Embed Badge

![Health badge](/badges/aw-studio-laravel-translatable-routes/health.svg)

```
[![Health](https://phpackages.com/badges/aw-studio-laravel-translatable-routes/health.svg)](https://phpackages.com/packages/aw-studio-laravel-translatable-routes)
```

###  Alternatives

[christianbarkowsky/contao-protectedselect

Adds a new form select widget which hides the internal field values in the frontend

107.4k1](/packages/christianbarkowsky-contao-protectedselect)[rexxars/morse

Generate morse code (text and/or wav-audio)

113.2k](/packages/rexxars-morse)

PHPackages © 2026

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