{"id":22640685,"url":"https://github.com/beastbytes/yii2-leaflet","last_synced_at":"2025-09-06T10:41:27.321Z","repository":{"id":56950598,"uuid":"158132433","full_name":"beastbytes/yii2-leaflet","owner":"beastbytes","description":"Yii2 extension to integrate the Leaflet JavaScript mapping library","archived":false,"fork":false,"pushed_at":"2018-11-18T22:24:02.000Z","size":478,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-07T23:37:50.099Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beastbytes.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":"2018-11-18T22:18:31.000Z","updated_at":"2018-11-18T22:21:36.000Z","dependencies_parsed_at":"2022-08-21T03:40:17.711Z","dependency_job_id":null,"html_url":"https://github.com/beastbytes/yii2-leaflet","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/beastbytes/yii2-leaflet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Fyii2-leaflet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Fyii2-leaflet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Fyii2-leaflet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Fyii2-leaflet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beastbytes","download_url":"https://codeload.github.com/beastbytes/yii2-leaflet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Fyii2-leaflet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273892837,"owners_count":25186562,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-12-09T04:13:08.086Z","updated_at":"2025-09-06T10:41:27.289Z","avatar_url":"https://github.com/beastbytes.png","language":"JavaScript","readme":"# BeastBytes\\Leaflet\nYii2 extension to integrate the Leaflet JavaScript mapping library.\n\n## Features\n\n-   For Leaflet V1.*\n-   Easy to use predefined tile providers (port of [Leaflet Providers](/leaflet-extras/leaflet-providers))\n-   Simple popup creation for markers and vector components; just set the 'content' option\n-   Simple plugin interface\n\nFor license information see the [LICENSE](LICENSE.md)-file.\n\n## Installation\n\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```\nphp composer.phar require --prefer-dist beastbytes/yii2-leaflet\n```\n\nor add\n\n```json\n\"beastbytes/yii2-leaflet\": \"*\"\n```\n\nto the require section of your composer.json.\n\n## Usage\n\nTo create a map, first create the components, e.g. markers, controls, shapes, etc., to display on the map, then run the Map widget, adding the the components in its configuration.\n\nThe example below displays a map using OpenStreetMap as the tile provider. It has a marker in the centre of the map and a 5km raduis circle centred on the marker; these are in a layer group that is not initially displayed. When the layer is shown using the Layers control, the centre marker can be dragged and dropped and it's new position is shown - this demonstrates using component events. Three other markers are added in another layer group, and a layers and fullscreen control is added to the map; the fullscreen control is a plugin.\n\n### Example\n```php\nuse BeastBytes\\Leaflet\\Map;\n\n$centre = new LatLng([\n    'lat' =\u003e 51.737022,\n    'lng' =\u003e -4.931467\n]);\n\n$centreLayerGroup = new LayerGroup([ // Layer group with a marker and circle\n    'layers' =\u003e [\n        new Circle([\n            'latLng' =\u003e $centre,\n            'content' =\u003e 'This circle has a 5km raduis', // Setting 'content' creates a popup\n            'options' =\u003e [\n                'radius' =\u003e 5000\n            ]\n        ]),\n        new Marker([\n            'latLng' =\u003e $centre,\n            'options' =\u003e [\n                'draggable' =\u003e true,\n                'icon' =\u003e new Icon([\n                    'options' =\u003e [\n                        'iconAnchor' =\u003e new Point(['x' =\u003e 12, 'y' =\u003e 40]), // This is important - it anchors a point in the image, measured in pixels from the top left of the image, to the geographical point given by latLng\n                        'iconUrl' =\u003e \"/images/leaflet/marker-icon-magenta.png\", // replace with your own image URL\n                        'shadowUrl' =\u003e '/images/leaflet/marker-shadow.png' // replace with your own image URL\n                    ]\n                ])\n            ],\n            'events' =\u003e [\n                'dragend' =\u003e 'function(e){\n                    var marker = e.target;\n                    var position = marker.getLatLng();\n                    window.alert(\"New position \" + position.lat + \" \" + position.lng);\n                }'\n            ]\n        ])\n    ]\n]);\n$centreLayerGroup-\u003emap = false; // don't show initially\n\n$icon = new Icon([\n    'options' =\u003e [\n        'iconAnchor' =\u003e new Point(['x' =\u003e 12, 'y' =\u003e 40]),\n        'iconUrl' =\u003e \"/images/leaflet/marker-icon-green.png\",\n        'shadowUrl' =\u003e '/images/leaflet/marker-shadow.png'\n    ]\n]);\n\n$pubLayers = [];\n$pubs = [\n    [\n        'name' =\u003e 'The Cottage Inn',\n        'address' =\u003e 'Llangwm, Haverfordwest, Dyfed SA62 4HH',\n        'tel' =\u003e '+44 1437 891494',\n        'location' =\u003e ['lat' =\u003e 51.749558, 'lng' =\u003e -4.911994]\n    ],\n    [\n        'name' =\u003e 'The Ferry Inn',\n        'address' =\u003e 'Pembroke Ferry, Pembroke Dock, Pembrokeshire SA72 6UD',\n        'tel' =\u003e '+44 1646 682947',\n        'location' =\u003e ['lat' =\u003e 51.707498, 'lng' =\u003e -4.927023]\n    ]\n];\n\nforeach ($pubs as $pub) {\n    $pubLayers[] = new Marker([\n        'latLng' =\u003e new LatLng($pub['location']),\n        'options' =\u003e compact('icon'),\n        'content' =\u003e '\u003cp\u003e\u003cb\u003e'.$pub['name'].'\u003c/b\u003e\u003c/p\u003e\u003cp\u003e'.$pub['address'].'\u003c/p\u003e\u003cp\u003eTel: '.$pub['tel'].'\u003c/p\u003e'\n    ]);\n}\n\n$pubsLayerGroup = new LayerGroup([ // group the public layers\n    'layers' =\u003e $pubLayers\n]);\n\n$layersControl = new Layers([ // create a layers control to control layer visibility\n    'overlays' =\u003e [\n        'Centre of Map' =\u003e $centreLayerGroup,\n        'Pubs' =\u003e $pubsLayerGroup\n    ]\n]);\n\necho Map::widget([\n    'options' =\u003e [\n        'id' =\u003e 'leaflet',\n        'style' =\u003e 'height:800px' // a height must be specified\n    ],\n    'mapOptions' =\u003e [\n        'center' =\u003e $centre,\n        'layers' =\u003e [\n            new TileProvider('OpenStreetMap') // this creates the tile layer\n        ],\n        'zoom' =\u003e 10\n    ],\n    'controls' =\u003e [\n        $layersControl,\n        new Scale()\n    ],\n    'layers' =\u003e [\n        $centreLayerGroup,\n        $pubsLayerGroup\n    ],\n    'plugins' =\u003e [\n        new Fullscreen()\n    ]\n]);\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeastbytes%2Fyii2-leaflet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeastbytes%2Fyii2-leaflet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeastbytes%2Fyii2-leaflet/lists"}