Download the PHP package yzh52521/think-geoip without Composer

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

think-geoip

Determine the geographical location of website visitors based on their IP addresses

install

Configuration Quick breakdown of the two main options in the configuration file. To find out more simple open the config/geoip.php file.

Service Configuration To simplify and keep things clean, all third party composer packages, that are needed for a service, are installed separately.

For further configuration options checkout the services page.

Caching Configuration GeoIP uses think default caching to store queried IP locations. This is done to reduce the number of calls made to the selected service, as some of them are rate limited.

Options:

all all location are cached some cache only the requesting user none caching is completely disable

基本用法

The simplest way to use these method is through the helper function geoip() or by using the facade \yzh52521\GeoIP\facades\GeoIP. For the examples below we will use the helper method.

获取网站访问者的位置数据:

Arguments: $ip - The Ip to look up. If not set the application default to the remote address.示例:

Default Location In the case that a location is not found the fallback location will be returned with the default parameter set to true. To set your own default change it in the configurations config/geoip.php

think Commands

publish Service Data

Updating Service Data Some services may need to update local files. For example the MaxMind Database service fetches a remote database and saves it to the local file system.

Clearing Cached Locations Some cache drivers offer the ability to clear stored location.

Methods

When the geoip() helper function is used without arguments it will return the \Torann\GeoIP\GeoIP instance, and with this we can do all types of amazing things.

Get the location from the provided IP.

Arguments:

$ip - The Ip to look up. If not set the application default to the remote address.

getService() Will return the default service used for determining location.

Will return the user IP address.

Services

Service Prerequisites Before using the MaxMind driver, you will need to install the appropriate package via Composer:

MaxMind: geoip2/geoip2 ~2.1 IP-API (default) They offer a free and pro service ip-api.com

MaxMind Database The database location to used is specified in the config file in the services section under maxmind_database. Along with the URL of where to download the database from when running the php artisan geoip:update. Note: The geoip:update command will need to be ran before the package will work.

Optimization Tip: When using the database option I don't like having the downloaded database in my git repository, so I have my deploy system run the geoip:update during the build process before it's deployed to the servers.

MaxMind API Register for a license key and user ID at www.maxmind.com

IPGEOLOCATION API Register at ipgeolocation.io to get api key and add it into your env file as: IPGEOLOCATION_KEY = YOUR_API_KEY

IPFINDER API Register at ipfinder.io to get api key and add it into your env file as: IPFINDER_API_KEY = YOUR_API_KEY

IPDATA API Register at ipdata.co to get api key and add it into your env file as: IPDATA_API_KEY = YOUR_API_KEY

Custom Service Services are stored in the GeoIP's config file config/geoip.php. Simply update the service with the name of your custom service and add it to the services specific configuration section with the class value as the custom classname.

Example service

In the config file


All versions of think-geoip with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
topthink/framework Version >=6.0
geoip2/geoip2 Version ~2.1
ext-json Version *
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 yzh52521/think-geoip contains the following files

Loading the files please wait ....