PHPackages                             yucadoo/laravel-geojson-rule - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. yucadoo/laravel-geojson-rule

ActiveLibrary

yucadoo/laravel-geojson-rule
============================

Laravel Validation Rule for GeoJSON.

2.0.7(2mo ago)16132.2k↓10.5%5MITPHPPHP &gt;=7.2

Since Mar 16Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/yucadoo/laravel-geojson-rule)[ Packagist](https://packagist.org/packages/yucadoo/laravel-geojson-rule)[ Docs](https://github.com/yucadoo/laravel-geojson-rule)[ RSS](/packages/yucadoo-laravel-geojson-rule/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (11)Used By (0)

laravel-geojson-rule
====================

[](#laravel-geojson-rule)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6d01b5f0d98e7d1a58d0828964c727a7a37bb9f59ea43919e17dc5f9682571b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f79756361646f6f2f6c61726176656c2d67656f6a736f6e2d72756c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yucadoo/laravel-geojson-rule)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/eb14993895eb481055513bad7f783fe3a0c9913c72003b22f5aada7082502dc5/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f79756361646f6f2f6c61726176656c2d67656f6a736f6e2d72756c652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/yucadoo/laravel-geojson-rule)[![Coverage Status](https://camo.githubusercontent.com/01348bbed33456a1b18585058a0507e3fc2c7e6e6f1a011f404afd21e42b7413/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f79756361646f6f2f6c61726176656c2d67656f6a736f6e2d72756c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/yucadoo/laravel-geojson-rule/code-structure)[![Quality Score](https://camo.githubusercontent.com/dc1a2093141a027fe6183607e48c5da5ebe4a0f22571d8c865846a098384973b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f79756361646f6f2f6c61726176656c2d67656f6a736f6e2d72756c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/yucadoo/laravel-geojson-rule)[![Total Downloads](https://camo.githubusercontent.com/b720cfcd86b20948ec6c85c7f0702dd407720555f73049b2b05188e4a8bbfe6b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f79756361646f6f2f6c61726176656c2d67656f6a736f6e2d72756c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yucadoo/laravel-geojson-rule)

Laravel Validation Rule for GeoJSON. Built on top of the [GeoJSON PHP Library](https://github.com/jmikola/geojson). This package is compliant with [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) and [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md). If you notice compliance oversights, please send a patch via pull request.

Install
-------

[](#install)

Via Composer

```
$ composer require yucadoo/laravel-geojson-rule
```

Usage
-----

[](#usage)

Create a new `GeoJsonRule` instance without arguments to accept any GeoJSON geometry.

```
use Illuminate\Support\Facades\Validator;
use YucaDoo\LaravelGeoJsonRule\GeoJsonRule;

$validator = Validator::make(
    ['geometry' => '{"type": "Point", "coordinates":[1, 2]}'],
    ['geometry' => new GeoJsonRule()] // Accept any geometry
);
$validator->passes(); // true

$validator = Validator::make(
    ['geometry' => '{"type": "Point", "coordinates":[1]}'],
    ['geometry' => new GeoJsonRule()] // Accept any geometry
);
$validator->passes(); // false
$messages = $validator->messages()->get('geometry');
$messages[0]; // The geometry does not satisfy the RFC 7946 GeoJSON Format specification because Position requires at least two elements
```

Pass the GeoJson geometry class to limit it.

```
use GeoJson\Geometry\Point;
use Illuminate\Support\Facades\Validator;
use YucaDoo\LaravelGeoJsonRule\GeoJsonRule;

$validator = Validator::make(
    ['position' => '{"type": "Point", "coordinates":[1, 2]}'],
    ['position' => new GeoJsonRule(Point::class)] // Accept Points only
);
$validator->passes(); // true

$validator = Validator::make(
    ['position' => '{"type": "LineString", "coordinates":[[1, 2], [3, 4]]}'],
    ['position' => new GeoJsonRule(Point::class)] // Accept Points only
);
$validator->passes(); // false
$messages = $validator->messages()->get('position');
echo $messages[0]; // The position does not satisfy the RFC 7946 GeoJSON Format specification for Point.
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Hrvoje Jukic](https://github.com/yucadoo)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance87

Actively maintained with recent releases

Popularity42

Moderate usage in the ecosystem

Community14

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~243 days

Recently: every ~318 days

Total

10

Last Release

62d ago

Major Versions

1.0.1 → 2.0.02020-04-16

PHP version history (2 changes)1.0.0PHP ~7.2

2.0.2PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/9c6e704cc57891bf1868f1afa8fda7068d53ba7fafdaabc630fec179c517665c?d=identicon)[Firtzberg](/maintainers/Firtzberg)

---

Top Contributors

[![Firtzberg](https://avatars.githubusercontent.com/u/8490119?v=4)](https://github.com/Firtzberg "Firtzberg (26 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (3 commits)")[![krzysztofrewak](https://avatars.githubusercontent.com/u/10898728?v=4)](https://github.com/krzysztofrewak "krzysztofrewak (1 commits)")[![wilburpowery](https://avatars.githubusercontent.com/u/15817188?v=4)](https://github.com/wilburpowery "wilburpowery (1 commits)")

---

Tags

laravelrulelaravelrulegeojsonyuca

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/yucadoo-laravel-geojson-rule/health.svg)

```
[![Health](https://phpackages.com/badges/yucadoo-laravel-geojson-rule/health.svg)](https://phpackages.com/packages/yucadoo-laravel-geojson-rule)
```

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[maize-tech/laravel-email-domain-rule

Laravel Email Domain Rule

611.9k](/packages/maize-tech-laravel-email-domain-rule)[basillangevin/laravel-data-json-schemas

Transforms Spatie Data objects into JSON Schemas with built-in validation

1312.2k1](/packages/basillangevin-laravel-data-json-schemas)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
