Download the PHP package apacheborys/location-bundle without Composer

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

Storage Location Bundle


Build Status

With that bundle, you will able to build own server of geo data. Manipulation functions:

Benefits

Install

Usage

First of all you need setup storage, where you will save data about locations. Available database providers here. For example, you can use FilesystemAdapter.

After, you need setup database configuration. If you don't want do it, you can use default configuration by creating class without any arguments. Take attention to useCompression flag, it can help to save size of storage. If you will use compression, please be sure what your database able to save binary data.

After that you can use Location bundle:

Please take attention what you need to take care for save data in database what you use. Also, in first moment you need to add places what you want, to find that future. Each place in database is specific Place entity, what contain collection of Address entities and properties - Polygons, Bounds, timezone, providedBy, currentLocale and objectHash. Bottom you can see example how you can save information. It just example, don't use it in production please.

After add place above, you will receive that place in reverseQuery for any coordinate what consisting in Place's polygons. If you will add place with highest admin level - you will receive that new place. That provider every time try to respond places with highest admin level (for reverseQuery method).

Find place what include specific coordinates point

Find place by text

For geocodeQuery use any text what you want to find.

Useful functions

Measuring distance between two coordinates

For measuring distance, please pass two coordinates to distance method. Please take attention what altitude take to calculation too.

In result, you will get distance in kilometers without rounding. As result, you will have preciseness more than millimeter.

Find common points in different places

If you want to find neighbour Places with one specific Place. It's very easy to use. Also you can find intersected routes for build way. You can try to find all places what contain common points. Please take attention than you can specify places what you want to check as third argument.

Where originalPlace is Place what we will take as base. And try to find common points from another places. maxDistanceToBorder is float value for minimum distance to possible common point. As default - 100 meters. specificPlaces is array of Places. If you will pass some Places in that argument. Location bundle will check only that Places for common points.

Working with Database

That bundle has methods for realize database functionality:

Take attention what each Place object identified in database according to objectHash property. Please use that property as read-only. If you will change that property, database provider will lose relation to that Place in database.

Take attention what each Address object identified in database according:

  1. Admin level - admin level name
  2. Locality, subLocality, streetName, streetNumber

If you want to change Place entity, you should delete that Place and add new Place with an already changed object. Also, please take attention what each object in database have time to life value (for PSR-6). By default, it's 365 days (1 year), you can setup it through passing specific argument in creation \ApacheBorys\Location\Model\DBConfig.

Database providers

You can choose what database provider you want to use. Now available 2 providers:

Also, please take attention to \ApacheBorys\Location\Model\DBConfig. You can find a lot config values what make possibility to fine tune.

If you want to save storage space you can enable compressing data here \ApacheBorys\Location\Model\DBConfig::$useCompression. Please take attention what you can adjust compression level here \ApacheBorys\Location\Model\DBConfig::$compressionLevel (1-9 values, default - 5). Please take attention, what compression performing through commands gzuncompress and gzcompress. Please take care for migration data from/to compress state by self.

If you don't want use data in databases, you should take care for deletion that by self.

PdoDatabase

You can use that provider if you are plan to store your places in sqlite, mysql or postgresql. For constructor, you need to pass \PDO object as first argument. Name of tables what will create on first provider call - \ApacheBorys\Location\Database\PdoDatabase\HelperInterface::queryForCreateTables.

Psr6Database

That provider is more simple and store data about place entity like a pile in cache. Please take care for data's TTL, because usually each cache (PSR-6) provider have standard TTL value. Also, you can adjust it by specify TTL value for \ApacheBorys\Location\Model\DBConfig::$ttlForRecord, default value is \ApacheBorys\Location\Model\DBConfig::TTL_FOR_RECORD.

For constructor, you need to pass any object what implement \Psr\Cache\CacheItemPoolInterface as first argument.

Testing

Please run composer test.

Warning

Please take attention what each geo data have owner and you should use it only in legitimate goals.


All versions of location-bundle with dependencies

PHP Build Version
Package Version
Requires php 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 apacheborys/location-bundle contains the following files

Loading the files please wait ....