nemesis/laragis
A geospatial library and set of utilities for Laravel. This is fork from https://github.com/ralphschindler/laragis
116
1
| Install | |
|---|---|
composer require nemesis/laragis |
|
| Latest Version: | 1.0.3 |
| PHP: | >=5.5 |
| License: | UNLICENSE |
| Last Updated: | Apr 11, 2017 |
| Links: | GitHub · Packagist |
Maintainer: nemesis1988
LaraGis
LaraGis provides geospatial database and Eloquent features to Laravel.
Features:
- 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:
composer require ralphschindler/laragis
Configuration
After installing the Socialite library, register the LaraGis\LaraGisProvider in your config/app.php configuration file:
'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:
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();
}
Related Packages
martin-georgiev/postgresql-for-doctrine
Extends Doctrine with native PostgreSQL support for arrays, JSONB, ranges, PostG...
5,973,650
456
array-data-types
arrays
binary-data
cidr
date-interval
dbal
doctrine
doctrine-dbal
doctrine-dql
doctrine-orm
doctrine-types
dql
embeddings
full-text-search
fuzzystrmatch
geo
geography
geometry
geospatial
gis
hash-store
hstore
inet
json
json-data
jsonb
jsonpath
levenshtein
ltree
macaddr
martin-georgiev
math-functions
money
multirange
network-types
pgsql
pgvector
postgis
postgis-geometry
postgres
postgres-extension
postgresql
range
soundex
spatial
text-search
trigonometry
tsquery
tsvector
uuid
vector
vector-search
xml