yucadoo/laravel-geojson-rule
Larablocks Analysis
yucadoo/laravel-geojson-rule works with Laravel 5 to 13 (latest release 2.0.7, Mar 17, 2026).
Recommendation checks
Solid choiceSolid choice: maintained and up to date, meets 2 of 4 checks; below the bar for Recommended on use.
- Works with Laravel 13, the current version
- Released in the last 12 months (Mar 17, 2026)
- 7,466 downloads a month (needs 10,000)
- 16 GitHub stars (needs 100)
State
Maintained- Last stable release: Mar 17, 2026.
- 1 release in the last 12 months.
- First released: Mar 16, 2020.
- Monthly downloads: 7,466.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Nov 27, 2026.
| Install | |
|---|---|
composer require yucadoo/laravel-geojson-rule |
|
| Latest Version: | 2.0.7 |
| PHP: | >=7.2 |
| Laravel: | 5 – 13 |
| License: | MIT |
| Last Updated: | Mar 17, 2026 |
| Links: | GitHub · Packagist |
laravel-geojson-rule
Laravel Validation Rule for GeoJSON. Built on top of the GeoJSON PHP Library. This package is compliant with PSR-1, PSR-2 and PSR-4. If you notice compliance oversights, please send a patch via pull request.
Install
Via Composer
$ composer require yucadoo/laravel-geojson-rule
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
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email hrcajuka@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Related Packages
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 2.0.7 | >=7.2 | ^5.5| | MIT | |
| 2.0.6 | >=7.2 | ^5.5| | MIT | |
| 2.0.5 | >=7.2 | ^5.5| | MIT | |
| 2.0.4 | >=7.2 | ^5.5| | MIT | |
| 2.0.3 | >=7.2 | ^5.5| | MIT | |
| 2.0.2 | >=7.2 | ^5.5| | MIT | |
| 2.0.1 | ~7.2 | ^5.5| | MIT | |
| 2.0.0 | ~7.2 | ^5.5| | MIT | |
| 1.0.1 | ~7.2 | ^5.5| | MIT | |
| 1.0.0 | ~7.2 | ^5.5| | MIT |