Download the PHP package jackardios/laravel-eloquent-spatial without Composer
On this page you can find all versions of the php package jackardios/laravel-eloquent-spatial. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jackardios/laravel-eloquent-spatial
More information about jackardios/laravel-eloquent-spatial
Files in jackardios/laravel-eloquent-spatial
Package laravel-eloquent-spatial
Short Description Spatial library for Laravel
License MIT
Homepage https://github.com/matanyadaev/laravel-eloquent-spatial
Informations about the package laravel-eloquent-spatial
Laravel Eloquent Spatial
This Laravel package allows you to easily work with spatial data types and functions.
This package supports MySQL v8, MySQL v5.7, and MariaDB v10.
Getting Started
Installing the Package
You can install the package via composer:
Setting Up Your First Model
-
First, generate a new model along with a migration file by running:
-
Next, add some spatial columns to the migration file. For instance, to create a "places" table:
-
Run the migration:
- In your new model, fill the
$fillable
and$casts
arrays and use theHasSpatial
trait:
Interacting with Spatial Data
After setting up your model, you can now create and access spatial data. Here's an example:
Further Reading
For more comprehensive documentation on the API, please refer to the API page.
Extension
You can add new methods to the Geometry
class through macros.
Here's an example of how to register a macro in your service provider's boot
method:
Use the method in your code:
Development
Here are some useful commands for development:
- Run tests:
composer pest
- Run tests with coverage:
composer pest-coverage
- Perform type checking:
composer phpstan
- Format your code:
composer php-cs-fixer
Before running tests, make sure to run docker-compose up
to start the database container.
Updates and Changes
For details on updates and changes, please refer to our CHANGELOG.
License
Laravel Eloquent Spatial is released under The MIT License (MIT). For more information, please see our License File.
All versions of laravel-eloquent-spatial with dependencies
ext-json Version *
ext-pdo Version *
laravel/framework Version ^10.0
phayes/geophp Version ^1.2