Download the PHP package tuupola/whereami without Composer

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

Whereami

Latest Version Build StatusCoverage

Common PHP interface for wifi positioning services, inspired by whoami.

Whereami

Install

Install the library using Composer. You will also need to choose a HTTP client for example php-http/curl-client.

If you do not install HTTP client you will get No HTTPlug clients found and Puli Factory is not available errors. Ignore the Puli part, you do not need it. Just install an HTTP client.

Finally if your project does not already have one, you must include a PSR-7 implementation. Good candidate is zendframework/zend-diactoros. Many frameworks such as Slim and Expressive already include PSR-7 by default and this part is not needed.

Usage

Current location

To find current computers location you must provide wifi location service provider and optionally a wifi network scanner. With macOS you can use AirportScanner which does not require any extra setup. With Linux based systems you can use IwlistScanner which needs root privileges to be run. Example below uses Mozilla Location Service.

Pro tip! Like mentioned above providing scanner is optional. If scanner is not provided system will try to autodetect it. This way same code should work in both macOS and *NIX systems.

Third party location

Sometimes it is useful to locate third party locations. For example you might have several IoT devices whose location you need to track. You can locate these by calling $locator->whereis($networks) method with network info as a parameter.

Providers

Combain Provider

This provider uses Combain CPS API. It requires an API key but they do offer free evaluation account for developers.

Google Geolocation Provider

This provider uses The Google Maps Geolocation API. You will need an API key. There are some limits on free usage.

Google Browserlocation Provider

This provider uses old undocumented browserlocation API. It does not require API key.

Mozilla Provider

This provider uses Mozilla Location Service (MLS). It requires an API key but you can use the key test for developing.

Radiocells Provider

This provider uses Radiocells Network Geolocation Services API. It is free to use and does not require an API key.

Unwired Provider

This provider uses Unwired Labs LocationAPI. API key is required but you can sign up for free developer account.

Scanners

Scanners scan the surrounding wifi networks and return the results as an array. This array is then given to a provider which uses the network data to retrieve the geoposition.

Airport Scanner

This is the default scanner for macOS. It uses the airport commandline tool from Apple80211 framework. Custom command can be passed via constructor. This is optional and should be used for example if your airport binary is located in non standard place

Iwlist With Sudo

This is the default scanner for Linux and other *NIX based systems. It uses the iwlist commandline tool. This scanner is bit more complicated to set up since it needs root privileges to be run.

There are several ways to get around this. The default one is to give your webserver privileges to run sudo iwlist without password by editing the /etc/sudoers file.

Then add the following to the end of the file.

After editing the file save and exit. Make sure you can run the command as your webserver user.

If you can see the scan results you are good to go.

Iwlist Without Sudo

If you do not want to give the webserver privileges to run iwlist as root you could set up a root cronjob which writes the scan results to text file instead.

Add the following line to the crontab. This will run the scan every 10 minutes.

After editing the file save and exit. Wait for 10 minutes to make sure your cron entry works.

If you can see the scan results you are good to go. However you must use custom command which uses the output from the cronjob.

Adapters

Some operating have commandline tools for determining the current position. Adapters provide an interface for these. You can use an adapter for developing if you do not have access to any external geopositioning provider.

Note that adapters always return the location of the current machine. They cannot be used to determine third party location. Trying to do so will trigger a PHP warning.

Corelocation

This adapter uses the macOS CoreLocationCLI tool. Internally it uses Core Location services. Install it using Homebrew.

LocateMe

This adapter uses the macOS LocateMe tool. Internally it uses Core Location services. Install it using Homebrew.

Testing

You can run tests either manually or automatically on every code change. Automatic tests require entr to work.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.


All versions of whereami with dependencies

PHP Build Version
Package Version
Requires php Version ^5.6 || ^7.0
php-http/httplug Version ^1.1
php-http/client-common Version ^1.5
tuupola/http-factory Version ^0.3.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 tuupola/whereami contains the following files

Loading the files please wait ....