Download the PHP package dotkernel/dot-geoip without Composer

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

dot-geoip

[!IMPORTANT] dot-geoip is a wrapper on top of maxmind/GeoIP2-php

OSS Lifecycle

OSS Lifecycle PHP from Packagist (specify version)

GitHub issues GitHub forks GitHub stars GitHub license

Build Static

SymfonyInsight

Install

You can install this library by running the following command:

composer require dotkernel/dot-geoip

If your application didn't already use it, the above command also installed dotkernel/dot-cli. In this case, see it's README file on how to use it.

Copy config file vendor/dotkernel/dot-geoip/config/autoload/geoip.global.php into your application's config/autoload directory.

Register the library's ConfigProvider by adding the following line to your application's config/config.php file:

Dot\GeoIP\ConfigProvider::class,

Register the library's synchronizer command by adding the following line to your application's config/autoload/cli.global.php file under the commands array key:

Dot\GeoIP\Command\GeoIpCommand::getDefaultName() => Dot\GeoIP\Command\GeoIpCommand::class,

Manage GeoLite2 database

You can download/update a specific GeoLite2 database, by running the following command:

php bin/cli.php geoip:synchronize -d {DATABASE}

Where {DATABASE} takes one of the following values: asn, city, country.

You can download/update all GeoLite2 databases at once, by running the following command:

php bin/cli.php geoip:synchronize

The output should be similar to the below, displaying per row: database identifier: previous build datetime -> current build datetime.

asn: n/a -> 2021-07-01 02:09:34
city: n/a -> 2021-07-01 02:09:20
country: n/a -> 2021-07-01 02:05:12

Get help for this command by running php bin/cli.php help geoip:synchronize.

Tip: If you setup the synchronizer command as a cronjob, you can add the -q|--quiet option, and it will output data only if an error has occurred.

Usage

Below is an example implementation of using DotGeoip to retrieve information about an IP address.

<?php

declare(strict_types=1);

namespace Api\Example\Service;

use Dot\GeoIP\Service\LocationServiceInterface;
use Throwable;

/**
 * Class ExampleService
 * @package Api\Example\Service
 */
class ExampleService
{
    protected LocationServiceInterface $locationService;

    /**
     * ExampleService constructor.
     * @param LocationServiceInterface $locationService
     */
    public function __construct(LocationServiceInterface $locationService)
    {
        $this->locationService = $locationService;
    }

    /**
     * @param string $ipAddress
     * @return object
     */
    public function myMethod(string $ipAddress): object
    {
        try {
            // You can use any of the below methods:

            // Get CountryData which includes isEuMember, isoCode and name
            return $this->locationService->getCountry($ipAddress);

            // Get ContinentData which includes code and name
            return $this->locationService->getContinent($ipAddress);

            // Get OrganizationData which includes asn and name
            return $this->locationService->getOrganization($ipAddress);

            // Get LocationData which includes all of the above + estimated coordinates + timezone
            return $this->locationService->getLocation($ipAddress);
        } catch (Throwable $exception) {
            // handle errors
        }
    }
}

All versions of dot-geoip with dependencies

PHP Build Version
Package Version
Requires php Version ~8.2.0 || ~8.3.0
dotkernel/dot-cli Version ^3.5
geoip2/geoip2 Version ^3.0
guzzlehttp/guzzle Version ^7.8
laminas/laminas-filter Version ^2.34
psr/container Version ^1.1
symfony/filesystem Version ^7.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 dotkernel/dot-geoip contains the following files

Loading the files please wait ....