aboleon/metaframework-google-places
Composer 安装命令:
composer require aboleon/metaframework-google-places
包简介
Google Places address autocomplete component for Laravel
README 文档
README
Google Places address autocomplete component for Laravel
Requirements
- PHP ^8.3
- Laravel ^11.0 | ^12.0
- MetaFramework Inputable
Installation
composer require aboleon/metaframework-google-places
Publish assets/config/translations:
php artisan vendor:publish --tag=mfw-google-places-config php artisan vendor:publish --tag=mfw-google-places-translations php artisan vendor:publish --tag=mfw-google-places-assets
Configuration
config/mfw-google-places.php:
return [ 'google' => [ 'places_api_key' => env('MFW_GOOGLE_PLACES_KEY', ''), ], ];
Usage
<x-mfw-google-places::form :model="$address" field="address" label="Address" :params="['required' => ['route', 'postal_code', 'locality']]" :hidden="['administrative_area_level_2']" :showCoords="true" />
Searchbar-only mode:
<x-mfw-google-places::form :model="$address" mode="searchbar" />
Custom search filters (Places API)
You can pass Places Autocomplete options through params. The component supports:
types(legacy; mapped toincludedPrimaryTypes)includedPrimaryTypesincludedSecondaryTypesincludedRegionCodes(or legacycomponentRestrictions.country)
Example: keep address results and also allow hotels/lodging:
<x-mfw-google-places::form :model="$address" :params="[ 'types' => ['geocode'], 'includedPrimaryTypes' => ['lodging'], ]" />
To fully customize, publish the component and use the native Blade tag:
<x-google-places />
Artisan Commands
php artisan mfw-google-places:make-geo-model
php artisan mfw-google-places:make-geo-for-model {model?}
php artisan mfw-google-places:publish-component [--force]
php artisan mfw-google-places:publish-request [--force]
mfw-google-places:make-geo-modelgenerates a new Geo model and migration with all Google Places fields.mfw-google-places:make-geo-for-modeladds a Google Places Geo relation and migration to an existing model (optionally provide the model class).mfw-google-places:publish-componentpublishesapp/View/Components/GooglePlaces.phpandresources/views/components/google-places.blade.phpfor customization (use--forceto overwrite).mfw-google-places:publish-requestpublishes aGooglePlacesRequesttoapp/Http/Requestsfor customization (use--forceto overwrite).
Validation example:
use MetaFramework\GooglePlaces\Validation\GoogleAddressValidation; $rules = (new GoogleAddressValidation()) ->setPrefix('address') ->setRequiredFields(['route', 'postal_code', 'locality']) ->rules();
Customize the published request:
php artisan mfw-google-places:publish-request
// app/Http/Requests/GooglePlacesRequest.php public function rules(): array { return (new GoogleAddressValidation()) ->setPrefix('address') ->setRequiredFields(['route', 'postal_code', 'locality']) ->rules(); }
aboleon/metaframework-google-places 适用场景与选型建议
aboleon/metaframework-google-places 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 32 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 aboleon/metaframework-google-places 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aboleon/metaframework-google-places 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 32
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 30
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-28