{"id":22572370,"url":"https://github.com/loveorigami/yii2-gmap","last_synced_at":"2026-05-02T09:31:51.554Z","repository":{"id":62519262,"uuid":"81555931","full_name":"loveorigami/yii2-gmap","owner":"loveorigami","description":"Google Maps Markers Widget for Yii2 ","archived":false,"fork":false,"pushed_at":"2019-08-20T14:48:48.000Z","size":36,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-02T15:11:36.258Z","etag":null,"topics":["gmaps","marker","widget","yii2"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loveorigami.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-10T10:44:17.000Z","updated_at":"2019-08-20T14:48:50.000Z","dependencies_parsed_at":"2022-11-02T14:45:59.944Z","dependency_job_id":null,"html_url":"https://github.com/loveorigami/yii2-gmap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loveorigami%2Fyii2-gmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loveorigami%2Fyii2-gmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loveorigami%2Fyii2-gmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loveorigami%2Fyii2-gmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loveorigami","download_url":"https://codeload.github.com/loveorigami/yii2-gmap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246049619,"owners_count":20715510,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gmaps","marker","widget","yii2"],"created_at":"2024-12-08T02:09:00.364Z","updated_at":"2026-05-02T09:31:51.494Z","avatar_url":"https://github.com/loveorigami.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Google Maps Widgets for Yii2\n===================================\n\nGoogleMaps Widget displays a set of user addresses as markers on the map.\n\nInstallation\n------------\n\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```\nphp composer.phar require loveorigami/yii2-gmap \"*\"\n```\n\nor add\n\n```\n\"loveorigami/yii2-gmap\": \"*\"\n```\n\nto the require section of your composer.json.\n\nConfiguration\n-------------\n\nTo configure the Google Maps key or other options like language, version, library, or map options:\n\n```php\necho lo\\widgets\\gmap\\MarkersWidget::widget([\n    'googleMapsUrlOptions' =\u003e [\n        'key' =\u003e 'this_is_my_key',\n        'language' =\u003e 'id',\n        'version' =\u003e '3.1.18',\n    ],\n    'googleMapsOptions' =\u003e [\n        'mapTypeId' =\u003e 'roadmap',\n        'tilt' =\u003e 45,\n        'zoom' =\u003e 5,\n    ],\n]);\n```\n\nOR via yii params configuration. For example:\n\n```php\n'params' =\u003e [\n    'googleMapsUrlOptions' =\u003e [\n        'key' =\u003e 'this_is_my_key',\n        'language' =\u003e 'id',\n        'version' =\u003e '3.1.18',\n     ],\n    'googleMapsOptions' =\u003e [\n        'mapTypeId' =\u003e 'roadmap',\n        'tilt' =\u003e 45,\n        'zoom' =\u003e 10,\n    ],\n],\n```\n\nTo get key, please visit [page](https://developers.google.com/maps/documentation/javascript/get-api-key)\n\nGoogle Maps Options you can find them on the [options page](https://developers.google.com/maps/documentation/javascript/reference)\n\nWidgets\n-------------------\n\n* Markers Widget\n----\n\nTo use GoogleMaps, you need to configure its [[locations]] property. For example:\n\n```php\necho lo\\widgets\\gmap\\MarkersWidget::widget([\n\t\t[\n\t\t\t'position' =\u003e [$model-\u003elat, $model-\u003elng],\n\t\t\t'open' =\u003e true,\n\t\t\t'content' =\u003e $model-\u003ename,\n\t\t],\n\t\t[\n\t\t\t'position' =\u003e [45.143400, -5.372400],\n\t\t\t'content' =\u003e 'My Marker',\n\t\t]\n]);\n```\n\n* Select Map Location Widget\n----\n\nDeclare model class which will save geographic coordinates:\n\n```php\nclass SearchLocation extends \\yii\\base\\Model\n{\n    ...\n    public $address;\n    public $longitude;\n    public $latitude;\n    ...\n}\n```\n\nRender widget:\n```php\n$model = new SearchLocation();\n$form = \\yii\\widgets\\ActiveForm::begin();\n...\n$form-\u003efield($model, 'address')-\u003ewidget(\\lo\\widgets\\gmap\\SelectMapLocationWidget::class, [\n    'attributeLatitude' =\u003e 'latitude',\n    'attributeLongitude' =\u003e 'longitude',\n]);\n...\n\\yii\\widgets\\ActiveForm::end();\n```\n\nTo use movable marker on the map describe draggable option:\n```php\n$model = new SearchLocation();\n$form = \\yii\\widgets\\ActiveForm::begin();\n...\n$form-\u003efield($model, 'address')-\u003ewidget(\\lo\\widgets\\gmap\\SelectMapLocationWidget::className(), [\n    'attributeLatitude' =\u003e 'latitude',\n    'attributeLongitude' =\u003e 'longitude',\n    'draggable' =\u003e true,\n]);\n...\n\\yii\\widgets\\ActiveForm::end();\n```\n\nTo use custom field template use placeholder {map} for ActiveField:\n```php\n$model = new SearchLocation();\n$form = \\yii\\widgets\\ActiveForm::begin();\n...\n$form-\u003efield($model, 'address', [\n    'template' =\u003e '{label}\u003cdiv class=\"custom-class\"\u003e\u003cdiv class=\"form-control\"\u003e{input}\u003c/div\u003e{map}\u003c/div\u003e{error}',\n])-\u003ewidget(\\lo\\widgets\\gmap\\SelectMapLocationWidget::className(), [\n    'attributeLatitude' =\u003e 'latitude',\n    'attributeLongitude' =\u003e 'longitude',\n]);\n...\n\\yii\\widgets\\ActiveForm::end();\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floveorigami%2Fyii2-gmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floveorigami%2Fyii2-gmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floveorigami%2Fyii2-gmap/lists"}