Download the PHP package matanyadaev/laravel-eloquent-spatial without Composer

On this page you can find all versions of the php package matanyadaev/laravel-eloquent-spatial. 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 laravel-eloquent-spatial

Laravel Eloquent Spatial

Latest Version on Packagist Tests Static code analysis Lint Total Downloads

This Laravel package allows you to easily work with spatial data types and functions.

Supported databases:

Getting Started

Installing the Package

You can install the package via composer:

Setting Up Your First Model

  1. First, generate a new model along with a migration file by running:

  2. Next, add some spatial columns to the migration file. For instance, to create a "places" table:

  3. Run the migration:

  4. In your new model, fill the $fillable and $casts arrays and use the HasSpatial 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

Extend Geometry class with macros

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:

Extend with custom geometry classes

You can extend the geometry classes by creating custom geometry classes and add functionality. You can also override existing methods, although it is not recommended, as it may lead to unexpected behavior.

  1. Create a custom geometry class that extends the base geometry class.

  2. Update the geometry class mapping in a service provider file.

  3. Update your model to use the custom geometry class in the $casts property or casts() method.

  4. Use the custom geometry class in your code.

Set default SRID

By default, the SRID is set to 0 (EPSG:0). You can set the default SRID for your application by setting the SRID constant in a service provider's boot method:

Development

Here are some useful commands for development:

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

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
ext-pdo Version *
laravel/framework Version ^10.0|^11.0
phayes/geophp Version ^1.2
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 matanyadaev/laravel-eloquent-spatial contains the following files

Loading the files please wait ....