Download the PHP package mikehaertl/localeurls without Composer

On this page you can find all versions of the php package mikehaertl/localeurls. 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 localeurls

Locale URLs

Automatic locale/language management for URLs.

This extension allows to use URLs that contain a language code like

/en/some/page
/de/some/page
http://www.example.com/en/some/page
http://www.example.com/de/some/page

Since 1.1.3 you can also configure friendlier language names if you want:

http://www.example.com/english/some/page
http://www.example.com/deutsch/some/page

The language code is automatically inserted into every URL created and read back on every request. No extra URL rules are required. For best user experience the language is also restored from session/cookie if the user returns to a URL without a language code.

Installation

Extract the package to your protected/extensions directory and rename it to localeurls. Then configure the components in your protected/config/main.php:

NOTE: You need to configure all available languages including the default language of your application. More specific language codes should come first, e.g. en_us before en above.

Mode of operation

With the above configuration in place you're all set to go. If a request comes in that has no language set, the component will try to auto detect the language from the HTTP headers and redirect to that URL, for example to www.example.com/fr. If fr is the default language of your application (i.e. what you configured in your main.php), it will not redirect - unless you set redirectDefault to true.

NOTE: If redirectDefault is enabled you can't access www.example.com anymore because you're always redirected to a specific language URL even for the default application language.

All URLs you create with any createUrl() and createAbsoluteUrl() method will also contain the current visitor's language in their URL. The same rules apply for the default language: Unless you set redirectDefault to true, the URLs you create will not contain a language code if the visitor uses the default language.

To let your users switch to another language, you can create URLs with the usual methods and add a language parameter there:

Once a user visited a URL with a language code in it, this language is stored in his session. If the user returns to the start page (or any other page) without a language in the URL, he's automatically redirected to his last language choice. See below for a useful widget that creates a simple language selector.

API

LocaleHttpRequest

Properties

Methods

LocaleUrlManager

Properties

How to switch languages

Here's a simple example how you can create a language selector widget. It creates a dropdown taylored towards the popular Bootstrap framework.

Changelog

1.1.6

1.1.5

1.1.4

1.1.3

Upgrade

From 1.0.0


All versions of localeurls with dependencies

PHP Build Version
Package Version
Requires php Version >=5.0.0
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 mikehaertl/localeurls contains the following files

Loading the files please wait ....