Search code examples
google-mapsyii2yii-extensions

Using Googlemaps in Yii2?


How do I use Googlemaps in Yii2 ?

I am not able to follow the Usage placed in http://www.yiiframework.com/extension/yii2-google-maps-library

Installation has been done, but I am getting error

Class 'dosamigos\google\maps\LatLng' not found

Could anyone provide a tutorial/examples where Yii uses Google Maps ?


Solution

  • Normally the use directive for third party extensione start with vendor could be you must add the vendor to the use where you use these class.

    try using

    use vendor\dosamigos\google\maps\LatLng;
    use vendor\dosamigos\google\maps\services\DirectionsWayPoint;
    use vendor\dosamigos\google\maps\services\TravelMode;
    use vendor\dosamigos\google\maps\overlays\PolylineOptions;
    use vendor\dosamigos\google\maps\services\DirectionsRenderer;
    use vendor\dosamigos\google\maps\services\DirectionsService;
    use vendor\dosamigos\google\maps\overlays\InfoWindow;
    use vendor\dosamigos\google\maps\overlays\Marker;
    use vendor\dosamigos\google\maps\Map;
    use vendor\dosamigos\google\maps\services\DirectionsRequest;
    use vendor\dosamigos\google\maps\overlays\Polygon;
    use vendor\dosamigos\google\maps\layers\BicyclingLayer;