PHP code example of nemesis / laragis

1. Go to this page and download the library: Download nemesis/laragis library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nemesis / laragis example snippets


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

    LaraGis\LaraGisProvider::class,
],

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"


/**
 * @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();
}