2017 © Pedro Peláez
 

library laragis

A geospatial library and set of utilities for Laravel

image

ralphschindler/laragis

A geospatial library and set of utilities for Laravel

  • Sunday, July 23, 2017
  • by ralphschindler
  • Repository
  • 2 Watchers
  • 6 Stars
  • 44 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 26 % Grown

The README.md

LaraGis

LaraGis provides geospatial database and Eloquent features to Laravel., (*1)

Features:, (*2)

  • Simple Entity API, for use in casting model properties
  • Fast serialization of geospatial data from MySql (not PHP userland) via ST_AsGeoJSON()

Installation

To get started with Socialite, add to your composer.json file as a dependency:, (*3)

composer require ralphschindler/laragis

Configuration

After installing the Socialite library, register the LaraGis\LaraGisProvider in your config/app.php configuration file:, (*4)

'providers' => [
    // Other service providers...

    LaraGis\LaraGisProvider::class,
],

Basic Usage

To use in Eloquent based models, use the LaraGisTrait, and specify a column to be cast into a geospatial datatype with the laragis key in the $casts array:, (*5)

class Place extends Model
{
    use LaraGisTrait;

    protected $table = 'places';

    protected $casts = [
        'coordinates' => 'laragis'
    ];
}
$place = App\Places::find(1);
$coordinates = $place->coordinates;
echo $coordinates->getLatitudeLongitude(); // "30, -90"

Entity API


/** * @property double $latitude * @property double $longitude */ class Coordinates { public function __construct($latitude = null, $longitude = null); public function setLatitude($latitude); public function getLatitude(); public function setLongitude($longitude); public function getLongitude(); public function castToString($separator, $coordinatesOrder = self::LATITUDE_FIRST) } class Area implements \IteratorAggregate, \Countable { public function addCoordinates(Coordinates $coordinates); public function getCoordinates(); }

The Versions

23/07 2017

dev-master

9999999-dev

A geospatial library and set of utilities for Laravel

  Sources   Download

Unlicense

The Requires

  • php >=5.5

 

The Development Requires

laravel php geo gis spatial geospatial