Download the PHP package terminal42/contao-geoip2-country without Composer

On this page you can find all versions of the php package terminal42/contao-geoip2-country. 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 contao-geoip2-country

terminal42/contao-geoip2-country

This Contao extension finds the country from the client IP. The website can then be customized based on this information.

This extension requires the MaxMind GeoIP2 database, either the GeoIP2 Country or GeoLite2 Country database. Be aware that you might need a commercial license of this product depending on your use case!

Features

  1. Limit content based on the user country
    By default, visibility for pages, articles, content elements and front end modules can be set for the country. For each content, you can either show only to or hide it from a list of countries.

  2. Symfony HTTP Reverse Proxy
    Integrated support for the Symfony HTTP Reverse Proxy allows a page to be cached for each country by using Vary headers. Without a supported reverse proxy, responses with country-specific content are automatically set to Cache-Control: private.

    This will be automatically configured for you in a Contao Managed Edition.

  3. Default country for members
    The detected country is set as the default country for new members, so the registration front end module already has the country pre-selected.

  4. Support for terminal42/contao-countryselect
    If the countryselect form field is added to a form, the default option is automatically set to the visitors country.

Note on page visibility

If the visibility of a root page is configured, it also affects all its subpages. This means if a root page is not available for a country, none of the pages in this tree will be available.

Enabling this on the fallback root page can lead to unwanted consequences, because the user will not be redirected to any page if none of the preferred languages match the browser!

Installation

Choose the installation method that matches your workflow!

Installation via Contao Manager

Search for terminal42/contao-geoip2-country in the Contao Manager and add it to your installation. Finally, update the packages.

Manual installation

Add a composer dependency for this bundle. Therefore, change in the project root and run the following:

Depending on your environment, the command can differ, i.e. starting with php composer.phar … if you do not have composer installed globally.

Then, update the database via the contao:migrate command or the Contao install tool.

HTTP Reverse Proxy

If you do not use the Contao Managed Edition, you can manually register the CacheHeaderSubscriber when using the Symfony Reverse Proxy including friendsofsymfony/http-cache.

Configuration

MaxMind GeoIP2 database

Install the binary MMDB file and configure its path in the GEOIP2_DATABASE environment variable (e.g. through your .env/.env.local file).

Bundle configuration

Default configuration:

Updating the MaxMind GeoIP2 database

Detecting the country from IP requires an up-to-date information source, as IPs change all the time. We recommend to use MaxMind's Automatic Update Support to keep your database up-to-date.

Access the current user country

To retrieve the current country in your own code, inject the Terminal42\Geoip2CountryBundle\CountryProvider service into your class. Then use the getCurrentCountry method and pass the request object to it.

Example in a Contao AbstractFrontendModule controller:

Thanks!

Thanks to Burki & Scherer AG (@Tsarma) for the original implementation and supporting the development.

License

This bundle is released under the MIT


All versions of contao-geoip2-country with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
contao/core-bundle Version ^4.13 || ^5.0
doctrine/dbal Version ^2.11 || ^3.0
geoip2/geoip2 Version ~2.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 terminal42/contao-geoip2-country contains the following files

Loading the files please wait ....