Skip to content

Commit dd0545c

Browse files
committed
Remove 0.0.0/composer-include-files (#66)
1 parent b89f5e4 commit dd0545c

File tree

3 files changed

+36
-6
lines changed

3 files changed

+36
-6
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ A convenient way to set up and use localized routes in a Laravel app.
2626
- [Use Fallback Locale](#-use-fallback-locale)
2727
- [Omit Slug for Main Locale](#-omit-slug-for-main-locale)
2828
- [Scoped Options](#-scoped-options)
29+
- [Load Helper Functions](#-load-helper-functions)
2930
- [Add Middleware to Update App Locale](#-add-middleware-to-update-app-locale)
3031
- [Detectors](#detectors)
3132
- [Stores](#stores)
@@ -149,6 +150,18 @@ Route::localized(function () {
149150
]);
150151
```
151152

153+
## 📂 Load Helper Functions
154+
155+
If you would like to use the `route()` helper function to generate localized URLs, you will need to load the helpers file before Laravel's helpers are loaded.
156+
You do this by requiring our `helpers.php` in your `public/index.php` file, right before composer's `autoload.php` is loaded:
157+
158+
```php
159+
require __DIR__.'/../vendor/codezero/laravel-localized-routes/src/helpers.php'; //=> add this line
160+
require __DIR__.'/../vendor/autoload.php';
161+
```
162+
163+
If you don't load the helpers file, you can always generate localized routes using `URL::route()` with Laravel's URL facade.
164+
152165
## 🧩 Add Middleware to Update App Locale
153166

154167
By default, the app locale will always be what you configured in `config/app.php`.

UPGRADE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Hopefully, this is now a 1000 times better structured and easier to digest.
1414

1515
If you have any problems or improvements, you are always welcome to create an issue or pull request.
1616

17+
---
18+
1719
### ➡ Minimum Requirements Updated
1820

1921
We dropped support for Laravel 5.6, 5.7, 5.8 and 6.x.
@@ -23,6 +25,26 @@ We dropped support for Laravel 5.6, 5.7, 5.8 and 6.x.
2325

2426
---
2527

28+
### ➡ Manually Load `route()` Helper
29+
30+
If you would like to continue to use the `route()` helper function to generate localized URLs, you will need to load the helpers file before Laravel's helpers are loaded.
31+
32+
This used to be handled automatically by a composer plugin, but this caused an issue for some people.
33+
Once we find a better way to automate this, we will implement it.
34+
35+
If you don't load the helpers file, you can always generate localized routes using `URL::route()` with Laravel's URL facade.
36+
37+
🔸 **Actions Required**
38+
39+
- Require our `helpers.php` in your `public/index.php` file, right before composer's `autoload.php` is loaded:
40+
41+
```php
42+
require __DIR__.'/../vendor/codezero/laravel-localized-routes/src/helpers.php'; //=> add this line
43+
require __DIR__.'/../vendor/autoload.php';
44+
```
45+
46+
---
47+
2648
### ➡ Middleware Changes
2749

2850
Applying the `CodeZero\LocalizedRoutes\Middleware\SetLocale` middleware is now more straightforward.

composer.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
],
2222
"require": {
2323
"php": "^7.2.5|^8.0",
24-
"0.0.0/composer-include-files": "^1.5",
2524
"codezero/browser-locale": "^3.0",
2625
"codezero/laravel-uri-translator": "^1.0",
2726
"codezero/php-url-builder": "^1.0",
@@ -58,11 +57,7 @@
5857
"config": {
5958
"preferred-install": "dist",
6059
"sort-packages": true,
61-
"optimize-autoloader": true,
62-
"allow-plugins": {
63-
"0.0.0/composer-include-files": true,
64-
"kylekatarnls/update-helper": true
65-
}
60+
"optimize-autoloader": true
6661
},
6762
"minimum-stability": "dev",
6863
"prefer-stable": true

0 commit comments

Comments
 (0)