Download the PHP package geertw/yii2-translatable-url-rule without Composer

On this page you can find all versions of the php package geertw/yii2-translatable-url-rule. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii2-translatable-url-rule

Latest Stable Version Total Downloads License

Yii2 TranslatableUrlRule

A custom URL rule class for Yii 2 which allows for translated URL rules.

This extension allows you to write URL rules per language. For example, you can have signup for en, aanmelden for nl and registrieren for de. Because this extension uses normal Yii2 UrlRule objects to build language-specific URL rules, you still have all power that comes with normal Yii URL rules, including URL parameters and regular expressions.

The current language is determined by the Yii::$app->language parameter. The value of this parameter is used to create and to parse URLs.

This extension does not set the current language parameter. Use codemix/yii2-localeurls for that.

Installation

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json file.

Usage

Update your URL rules to use this class and set the patterns per language.

The route parameter remains the same for all rules. patterns is an array of all patterns, the key must equal the Yii language identifier. If there is no pattern for a language, the first configured pattern will be used.

Set forceRuleSearch to true to force searching in all rule patterns.

You may omit the class configuration in your URL rules when you configure a ruleConfig in UrlManager:

Language switcher example

Due to the way this library works, you need to specify two language parameters when creating URLs for routes in another language.

The following two code snippets allow you to create a simple dropdown which allows users to select alternative languages for the current route:

Create a widget like this:

Insert the following code in your view code:

You might recognize this example, as it is largely based on the example for yii2-localeurls.


All versions of yii2-translatable-url-rule with dependencies

PHP Build Version
Package Version
Requires yiisoft/yii2 Version ^2.0.13
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package geertw/yii2-translatable-url-rule contains the following files

Loading the files please wait ....