Skip to content

Commit ad91887

Browse files
committed
Update README
1 parent 87eba11 commit ad91887

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

README.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# Laravel Localized Routes
22

3-
This package is in development. Feedback is much appreciated!
3+
[![GitHub release](https://img.shields.io/github/release/codezero-be/laravel-localized-routes.svg)]()
4+
[![License](https://img.shields.io/packagist/l/codezero/laravel-localized-routes.svg)]()
5+
[![Build Status](https://scrutinizer-ci.com/g/codezero-be/laravel-localized-routes/badges/build.png?b=master)](https://scrutinizer-ci.com/g/codezero-be/laravel-localized-routes/build-status/master)
6+
[![Code Coverage](https://scrutinizer-ci.com/g/codezero-be/laravel-localized-routes/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/codezero-be/laravel-localized-routes/?branch=master)
7+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/codezero-be/laravel-localized-routes/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/codezero-be/laravel-localized-routes/?branch=master)
8+
[![Total Downloads](https://img.shields.io/packagist/dt/codezero/laravel-localized-routes.svg)](https://packagist.org/packages/codezero/laravel-localized-routes)
49

5-
## Features
10+
#### A convenient way to set up, manage and use localized routes in a Laravel app.
611

712
- [Automatically register](#register-routes) a route for each locale you wish to support.
813
- [Generate localized route URL's](#generate-route-urls) in the simplest way using the `route()` helper.
@@ -11,13 +16,18 @@ This package is in development. Feedback is much appreciated!
1116
- Let you work with routes without thinking too much about locales.
1217
- Optionally [translate each segment](#translate-routes) in your URI's.
1318

19+
## Requirements
20+
21+
- PHP >= 7.1
22+
- Laravel >= 5.6
23+
1424
## Install
1525

16-
```
26+
```php
1727
composer require codezero/laravel-localized-routes
1828
```
1929

20-
> Laravel >= 5.5 will automatically register the ServiceProvider.
30+
> Laravel will automatically register the ServiceProvider.
2131
2232
#### Publish Configuration File
2333

@@ -68,7 +78,7 @@ In the above example there are 5 routes being registered. The routes defined in
6878
| /en/admin/reports | en.admin.reports.index |
6979
| /nl/admin/reports | nl.admin.reports.index |
7080

71-
## Generate Route URL's
81+
### Generate Route URL's
7282

7383
You can get the URL of your named routes as usual, using the `route()` helper.
7484

@@ -105,7 +115,7 @@ $url = route('en.about', [], true, 'nl'); // /nl/about
105115

106116
> **Note:** in a most practical scenario you would register a route either localized **or** non-localized, but not both. If you do, you will always need to specify a locale to get the URL, because non-localized routes always have priority when using the `route()` function.
107117
108-
## Redirect to Routes
118+
### Redirect to Routes
109119

110120
Laravel's `Redirector` uses the same `UrlGenerator` as the `route()` function behind the scenes. Because we are overriding this class, you can easily redirect to your routes.
111121

@@ -120,17 +130,17 @@ You can't redirect to URL's in a specific locale this way, but if you need to, y
120130
return redirect(route('about', [], true, 'nl')); // redirects to /nl/about
121131
```
122132

123-
## Translate Routes
133+
### Translate Routes
124134

125135
If you want to translate the segments of your URI's, create a `routes.php` language file for each locale you [configured](#configure-supported-locales):
126136

127137
```
128-
resources/
129-
|-lang/
130-
|-en/
131-
| |-routes.php
132-
|-nl/
133-
|-routes.php
138+
resources
139+
└── lang
140+
├── en
141+
│ └── routes.php
142+
└── nl
143+
└── routes.php
134144
```
135145

136146
In these files, add a translation for each segment.

0 commit comments

Comments
 (0)