Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Geojson Rule

Laravel Geojson Rule Laravel Package

yucadoo/laravel-geojson-rule

A Laravel validation rule for GeoJSON. Validate geometries, features, and feature collections in form requests or validators, helping ensure map data and spatial payloads are well-formed before storage or processing.

View on GitHub
Deep Wiki
Context7

Laravel Validation Rule for GeoJSON.

Frequently asked questions about Laravel Geojson Rule
How do I install yucadoo/laravel-geojson-rule in a Laravel app?
Install it with Composer using a pinned constraint such as ^2.0.7. There is no service provider configuration, migration, or published assets to manage. Reference the rule directly in a FormRequest or an inline $request->validate([...]) call.
What GeoJSON types does this Laravel validation rule accept?
The package is designed to validate GeoJSON payloads such as geometries, features, and feature collections as defined by RFC 7946. It is a validation rule, not a geometry engine, so it checks payload shape rather than performing spatial operations. Confirm the exact accepted and rejected cases with contract tests for your product.
Does yucadoo/laravel-geojson-rule support Laravel 13?
Release 2.0.7 adds Laravel 13.x compatibility through a Laravel Shift pull request. That release is a maintenance and compatibility update, not a behaviour change: no API surface moved and no migration is required. Verify your pinned PHP version against the package composer.json before merging.
Is this package a replacement for PostGIS or spatial database queries?
No. It only validates that an incoming payload is well-formed GeoJSON at the application boundary. It does not replace PostGIS, spatial indexes, distance calculations, SRID-aware storage, or geo column work. Treat it as one validation layer, not as your spatial data platform.
Does the rule validate coordinate ranges, ring winding, or CRS assumptions?
Do not assume it enforces semantic geometry rules such as coordinate ranges, ring winding, or CRS assumptions unless you have verified that behaviour yourself. The practical integration work is agreeing whether the rule guarantees schema validity, semantic validity, or coordinate range checks. Write contract tests around the accepted and rejected cases your product actually cares about, and add extra validation where needed.
What are the risks of using a single-maintainer package in my API validation path?
The technical risk is low, but the structural risk is real: a small single-maintainer package in a public API validation path is a single point of failure. Validation code can also fail silently by accepting something it should reject, or the reverse. Pin the version, treat the rule as one layer in a defence-in-depth strategy, and keep an internal fallback if the package stalls.
How should I test GeoJSON validation in a Laravel form request?
Add a small set of contract tests covering valid Feature, FeatureCollection, and Geometry payloads. Include known-invalid cases such as malformed ring closure, wrong nesting, and missing required members. Run these tests in CI against the Laravel version you use in production so the compatibility claim is actually exercised.
Can I use this validation rule outside Laravel, such as with Symfony or Slim?
No, this package is native to Laravel and assumes Composer plus a conventional Laravel validation workflow. Teams on non-Laravel PHP frameworks would be adopting an alien dependency and should look elsewhere. It fits Laravel validator extension points cleanly and needs no framework-level configuration.
Does upgrading from 2.0.6 to 2.0.7 require any migration or code changes?
No migration or code changes are required. The only change is widened framework compatibility for Laravel 13.x, with no breaking changes, renamed classes, or config changes. Existing consumers can take it as a routine patch bump, or schedule it deliberately if they are mid-flight on a Laravel major upgrade.
What alternatives or complementary tools should I consider for GeoJSON validation in Laravel?
Alternatives include custom Laravel validator closures, JSON Schema validation, or full geometry libraries when you need coordinate-level semantic checks. This package is best viewed as a focused RFC 7946 structure rule and a lightweight leaf dependency. Combine it with additional validation in defence in depth if geospatial input is critical to your API.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource