Skip to content

Commit

Permalink
Remove 0.0.0/composer-include-files (codezero-be#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanvermeyen committed Mar 31, 2023
1 parent b89f5e4 commit dd0545c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ A convenient way to set up and use localized routes in a Laravel app.
- [Use Fallback Locale](#-use-fallback-locale)
- [Omit Slug for Main Locale](#-omit-slug-for-main-locale)
- [Scoped Options](#-scoped-options)
- [Load Helper Functions](#-load-helper-functions)
- [Add Middleware to Update App Locale](#-add-middleware-to-update-app-locale)
- [Detectors](#detectors)
- [Stores](#stores)
Expand Down Expand Up @@ -149,6 +150,18 @@ Route::localized(function () {
]);
```

## 📂 Load Helper Functions

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.
You do this by requiring our `helpers.php` in your `public/index.php` file, right before composer's `autoload.php` is loaded:

```php
require __DIR__.'/../vendor/codezero/laravel-localized-routes/src/helpers.php'; //=> add this line
require __DIR__.'/../vendor/autoload.php';
```

If you don't load the helpers file, you can always generate localized routes using `URL::route()` with Laravel's URL facade.

## 🧩 Add Middleware to Update App Locale

By default, the app locale will always be what you configured in `config/app.php`.
Expand Down
22 changes: 22 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Hopefully, this is now a 1000 times better structured and easier to digest.

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

---

### ➡ Minimum Requirements Updated

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

---

### ➡ Manually Load `route()` Helper

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.

This used to be handled automatically by a composer plugin, but this caused an issue for some people.
Once we find a better way to automate this, we will implement it.

If you don't load the helpers file, you can always generate localized routes using `URL::route()` with Laravel's URL facade.

🔸 **Actions Required**

- Require our `helpers.php` in your `public/index.php` file, right before composer's `autoload.php` is loaded:

```php
require __DIR__.'/../vendor/codezero/laravel-localized-routes/src/helpers.php'; //=> add this line
require __DIR__.'/../vendor/autoload.php';
```

---

### ➡ Middleware Changes

Applying the `CodeZero\LocalizedRoutes\Middleware\SetLocale` middleware is now more straightforward.
Expand Down
7 changes: 1 addition & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
],
"require": {
"php": "^7.2.5|^8.0",
"0.0.0/composer-include-files": "^1.5",
"codezero/browser-locale": "^3.0",
"codezero/laravel-uri-translator": "^1.0",
"codezero/php-url-builder": "^1.0",
Expand Down Expand Up @@ -58,11 +57,7 @@
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true,
"allow-plugins": {
"0.0.0/composer-include-files": true,
"kylekatarnls/update-helper": true
}
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true
Expand Down

0 comments on commit dd0545c

Please sign in to comment.