swisnl/filament-geometry
Composer 安装命令:
composer require swisnl/filament-geometry
包简介
Geometry form field for Filament PHP
README 文档
README
Warning
Work in progress, not stable yet!
Installation
You can install the package via composer:
composer require swisnl/filament-geometry
Important
If you have not set up a custom theme and are using Filament Panels follow the instructions in the Filament Docs first.
After setting up a custom theme add the plugin's views to your theme css file or your app's css file if using the standalone packages.
@source '../../../../vendor/swisnl/filament-geometry/resources/**/*.blade.php';
Component
Geometry Field
The Geometry field displays a Leaflet map, with a set of configuration options.
Usage
Geometry Field
Important
This field is designed to be used in conjunction with a database column of type (MULTI)POINT, (MULTI)LINESTRING, (MULTI)POLYGON or GEOMETRY. It currently does not support geometries with mixed types i.e. GEOMETRYCOLLECTION.
The form field can be used with no options, by simply adding this to your Filament form schema:
use Filament\Forms\Form; use Swis\Filament\Geometry\Enums\DrawMode; use Swis\Filament\Geometry\Forms\Geometry; public function form(Form $form): Form { return $form ->schema([ Geometry::make('location'), ]); }
Full options
The full set of options is as follows. Some option methods support closures, as well as direct values.
use Filament\Forms\Form; use Swis\Filament\Geometry\Bounds; use Swis\Filament\Geometry\Enums\ControlPosition; use Swis\Filament\Geometry\Enums\DrawMode; use Swis\Filament\Geometry\Forms\Geometry; use Swis\Filament\Geometry\GeoSearchProviders\OpenStreetMap; use Swis\Filament\Geometry\Icons\Marker; use Swis\Filament\Geometry\TileLayers\Carto; public function form(Form $form): Form { return $form ->schema([ Geometry::make('location') ->label(__('Location')) // Map configuration ->maxZoom(16) ->minZoom(4) ->center(52.164206390898904, 4.491920969490259) ->zoom(15) ->bounds(Bounds::make(49.5, -11, 61, 2)) // Example for British Isles ->tileLayer(Carto::make()) // Marker configuration ->markerIcon(Marker::make('#3b82f6')) // Controls ->showFullscreenControl(true) ->showZoomControl(true) ->showAttributionControl(true) ->geoSearch(OpenStreetMap::make()) ->drawModes([ DrawMode::Polygon, DrawMode::Rectangle, ]) ->multipart(false) ->drawControlPosition(ControlPosition::TopRight), ]); }
Casts
The field automatically tries to detect the type of your attribute by checking the model's casts. We currently support the following casts out of the box:
string(orencrypted)array(orencrypted:array)object(orencrypted:object)- Geometries from matanyadaev/laravel-eloquent-spatial
If we cannot detect the type automatically, you can specify it manually using one of the following methods:
use Filament\Forms\Form; use Swis\Filament\Geometry\Forms\Geometry; public function form(Form $form): Form { return $form ->schema([ Geometry::make('location') // Use one of the following state cast methods: ->asString() ->asArray() ->asObject() ->asEloquentSpatial() // Or use a custom state cast that implements \Filament\Schemas\Components\StateCasts\Contracts\StateCast: ->stateCast(new YourCustomStateCast()), ]); }
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
SWIS ❤️ Open Source
SWIS is a web agency from Leiden, the Netherlands. We love working with open source software.
swisnl/filament-geometry 适用场景与选型建议
swisnl/filament-geometry 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.89k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 07 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「swisnl」 「filamentphp」 「filament-geometry」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 swisnl/filament-geometry 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 swisnl/filament-geometry 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 swisnl/filament-geometry 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Fixture handler for Guzzle 6+
Model Context Protocol client implementation in PHP
PHP server integration for AG-UI - standardized AI agent frontend communication via Server-Sent Events
NDW Melvin API client
Laravel lti provider
Integrates spatie/laravel-activitylog with Filament
统计信息
- 总下载量: 2.89k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-02

