Download the PHP package stevebauman/location without Composer

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

Location

Retrieve a visitor's location from their IP address using various services.

Requirements

Installation

Install location using composer require:

Publish the configuration file (this will create a location.php file inside the config directory):

Usage

Retrieve a client's location

Important:

  • This method retrieves the user's IP address via request()->ip().
  • In the default configuration, testing.enabled is active, the returned IP address is in the USA. Disable it to get the client's real IP address.

Retrieve the location of a specific IP address

Drivers

Available Drivers

Available drivers:

Setting up MaxMind with a self-hosted database (optional)

We encourage setting up MaxMind as a fallback driver using a local database, as it allows you to bypass any throttling that could occur from using external web services.

To set up MaxMind to retrieve the user's location from your own server, you must:

  1. Create a maxmind account and sign in
  2. Click "Manage License Keys" from the profile menu dropdown
  3. Generate a new license key
  4. Copy the license key and save it into your .env file using the MAXMIND_LICENSE_KEY key
  5. Run php artisan location:update to download the latest .mmdb file into your database/maxmind directory
  6. That's it, you're all set!

Note: Keep in mind, you'll need to update this file by running location:update on a regular basis to retrieve the most current information from your visitors.

Fallback Drivers

In the config file, you can specify as many fallback drivers as you wish. It is recommended to configure the MaxMind driver with the local database .mmdb file (mentioned above), so you are alwaysretrieving some generic location information from the visitor.

If an exception occurs trying to grab a driver (such as a 400/500 error if the providers API changes), it will automatically use the next driver in line.

Creating your own drivers

To create your own driver, simply create a class in your application, and extend the abstract Driver:

Then, insert your driver class name into the configuration file:

Upgrading from v6

In version 7, the codebase has been updated with strict PHP types, updated PHP and Laravel version requirements, an updated Driver structure, as well as a small configuration addition.

Configuration

In version 7, location drivers can now implement an Updatable interface that allows them to be updated using the location:update command. Currently, only the MaxMind driver supports this.

To update your configuration file to be able to download the latest MaxMind database file automatically, insert the below url configuration option in your config/location.php file:

Once done, you may execute the below artisan command to download the latest .mmdb file:

Drivers

In version 7, the codebase has been updated with strict PHP types, updated PHP and Laravel version requirements, and an updated Driver structure.

If you have created your own custom driver implementation, you must update it to use the base Driver or HttpDriver class.

If you're fetching a location using an HTTP service, it may be useful to extend the HttpDriver to reduce the code you need to write:

Versioning

Location is versioned under the Semantic Versioning guidelines as much as possible.

Releases will be numbered with the following format:

And constructed with the following guidelines:

Minor versions are not maintained individually, and you're encouraged to upgrade through to the next minor version.

Major versions are maintained individually through separate branches.


All versions of location with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-json Version *
ext-curl Version *
geoip2/geoip2 Version ^2.0
guzzlehttp/guzzle Version ^7.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.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 stevebauman/location contains the following files

Loading the files please wait ....