Download the PHP package domprojects/codeigniter4-localize without Composer
On this page you can find all versions of the php package domprojects/codeigniter4-localize. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download domprojects/codeigniter4-localize
More information about domprojects/codeigniter4-localize
Files in domprojects/codeigniter4-localize
Package codeigniter4-localize
Short Description Locale management and URL localization filter for CodeIgniter 4 projects.
License MIT
Homepage https://github.com/domProjects/codeigniter4-localize
Informations about the package codeigniter4-localize
Localize for CodeIgniter 4
Locale management and URL localization filter for CodeIgniter 4.
This package adds a reusable localization filter that can:
- detect the visitor locale
- redirect root requests like
/to/{locale} - redirect requests without locale prefix to
/{locale}/... - persist the active locale in session and cookie
- validate locale segments against
Config\App::$supportedLocales
Installation
How It Works
The package registers a localize filter automatically through a Registrar.
It does not modify app/Config/Filters.php manually.
Configuration
The package uses two configuration sources:
Config\AppdomProjects\CodeIgniterLocalize\Config\Localize
You should configure your project locales in app/Config/App.php:
Optional package behavior can be customized by creating:
Example:
Recommended Behavior
Locale priority:
- locale found in URL
- locale stored in session
- locale stored in cookie
- browser language
Config\App::$defaultLocale
Recommended request behavior:
/redirects to/{locale}/aboutredirects to/{locale}/about/fr/aboutappliesfr/zz/aboutreturns404wheninvalidLocaleBehavior = '404'- assets and technical paths stay excluded from localization
Routes
For locale-prefixed URLs, a route group like this is recommended:
If your application does not use locale prefixes in routes, you can disable automatic redirection in the package config.
Package Structure
License
MIT