Installing ip2location-php required library for Smart IP's data source IP2Location binary database

Using Smart IP's data source IP2Location binary database requires ip2location/ip2location-php library which contains API that reads its database file. This article will show how to setup this API using composer.

The following procedures are tested on my Linode server running Centos 7 64-bit Linux distribution.

  1. First we will install composer:

    curl -sS | php
    mv composer.phar /usr/local/bin/composer

    Steps in installing composer in Windows check here.

  2. There are two ways we can install IP2Location API library: first way is by directly installing it on your Drupal root path:

    cd /var/www/
    composer require ip2location/ip2location-php:~8.0

    Note: change /var/www/ to your Drupal root path.

    Second way is by installing Smart IP module using composer which will install the IP2Location API library automatically.

    The first way is preferred if you downloaded the Smart IP module directly from its project page and extracted it manually to your Drupal installation.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.