coopbelvedere/laravel-localized-url
Composer 安装命令:
composer require coopbelvedere/laravel-localized-url
包简介
Simple locale prefixed routes for Laravel
README 文档
README
This is a laravel package to create simple locale prefixed routes and setting that locale in your laravel app. Be careful if you choose to use this package, as no more features will be added. For a more complete solution, please use Laravel Localization Package.
Prerequisites
- PHP 7
- Laravel 5.6
Configuration
php artisan vendor:publish --provider="Belvedere\LocalizedUrl\LocalizedUrlServiceProvider"
In the app/config/localized-url.php file:
Set default_locale_redirect to true if you want the default language to
be removed from the url when accessed directly.
The locales key are the locales allowed in your url. If it's an array, it
will use those locales, but you can also pass a key from another config file,
like app.locales if you already have this set in your application.
You can add the locale prefix to your app/Providers/RouteServiceProvider.php:
use Belvedere\LocalizedUrl\LocalizedUrlFacade as LocalizedUrl; class RouteServiceProvider extends ServiceProvider { ... protected function mapWebRoutes() { Route::middleware('web') ->namespace($this->namespace) ->prefix(LocalizedUrl::urlPrefix()) ->group(base_path('routes/web.php')); }
Also add \Belvedere\LocalizedUrl\Middleware\RedirectLocale::class, to your
web stack in app/Http/Middleware/Kernel.php for the redirections to work.
You're all set!
This package does not:
- Detect the browser language and keep the language in the session.
- Have any helpers to get the current route in other languages.
- Have any kind of solutions for dynamic content translations.
If you feel that's more what you need, you can consider using the Laravel Localization Package instead.
License
Copyright (c) 2017-present, Coopérative Belvédère Communication
coopbelvedere/laravel-localized-url 适用场景与选型建议
coopbelvedere/laravel-localized-url 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 25 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 07 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 coopbelvedere/laravel-localized-url 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 coopbelvedere/laravel-localized-url 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 25
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-07-27