### Install Httplug Adapters with Composer Source: https://github.com/bresam/ivory-google-map/blob/master/doc/installation.md These commands install the necessary Httplug components for making HTTP requests and handling responses. It includes a specific adapter (Guzzle7) and a message factory. ```bash composer require php-http/guzzle7-adapter composer require php-http/message ``` -------------------------------- ### Start Docker Services for Testing Source: https://github.com/bresam/ivory-google-map/blob/master/doc/development_environment.md Starts the Docker services in detached mode, preparing the environment for running tests. This command is typically used before executing test suites. ```bash docker-compose up -d ``` -------------------------------- ### Install Composer Dependencies Source: https://github.com/bresam/ivory-google-map/blob/master/doc/development_environment.md Installs project dependencies using Composer within a Docker container. This command ensures all necessary PHP libraries are available for the project. ```bash docker-compose run --rm php composer install ``` -------------------------------- ### Install Ivory Serializer with Composer Source: https://github.com/bresam/ivory-google-map/blob/master/doc/installation.md This command installs the Ivory Serializer library, which is required for deserializing HTTP responses when using services like geocoders or directions. ```bash composer require egeloen/serializer ``` -------------------------------- ### Install and Configure HTTP Plugins for Services Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/service.md Installs and configures recommended HTTPlug plugins for improved performance and error handling, including Retry, Http Error, Google Error, and Cache plugins. Requires 'php-http/client-common', 'php-http/cache-plugin', and 'symfony/cache'. ```bash composer require php-http/client-common composer require php-http/cache-plugin composer require symfony/cache ``` -------------------------------- ### Include Autoloader in PHP Script Source: https://github.com/bresam/ivory-google-map/blob/master/doc/installation.md This PHP code snippet demonstrates how to include the Composer autoloader file, making the installed Ivory Google Map library classes available for use in your project. ```php getPlaceId(); // Get the formatted address $formattedAddress = $place->getFormattedAddress(); // Get the rating $rating = $place->getRating(); // Get address components filtered by type 'route' $routeComponents = $place->getAddressComponents('route'); ``` ``` -------------------------------- ### Build Docker Project Source: https://github.com/bresam/ivory-google-map/blob/master/doc/development_environment.md Builds the Docker images and services defined in the 'docker-compose.yml' file. This command should be run after configuring the environment variables. ```bash docker-compose build ``` -------------------------------- ### Install Ivory Google Map using Composer Source: https://github.com/bresam/ivory-google-map/blob/master/README.md This command installs the core Ivory Google Map library using Composer, the dependency manager for PHP. Ensure Composer is installed and accessible in your project's root directory. ```bash composer require ivory/google-map ``` -------------------------------- ### Configure Serializer Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/service.md Sets the serializer for the service. This example uses the default Ivory Serializer. ```php use Ivory\Serializer\Serializer; $service->setSerializer(new Serializer()); ``` -------------------------------- ### Get Place Reviews Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/place/base/place.md Retrieves an array of up to five reviews for the place. Consult the review documentation for more information on each review object. ```php $reviews = $place->getReviews(); ``` -------------------------------- ### Get Place Opening Hours Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/place/base/place.md Retrieves information about the place's opening hours. Consult the opening hours documentation for more details. ```php $openingHours = $place->getOpeningHours(); ``` -------------------------------- ### Configure HTTP Client with Guzzle7 Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/service.md Allows updating the HTTP client for services. This example uses the Guzzle7 adapter, but any HTTPlug-compliant client can be used. ```php use Http\Adapter\Guzzle7\Client; $service->setClient(new Client()); ``` -------------------------------- ### Get Start Address (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves the human-readable street address for the start location of a leg. ```php $startAddress = $leg->getStartAddress(); ``` -------------------------------- ### Get Start Location (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves the starting coordinate of a leg. This is represented by a Coordinate object. ```php $startLocation = $leg->getStartLocation(); ``` -------------------------------- ### Get Place Website Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/place/base/place.md Retrieves the authoritative website for the place, typically the business's homepage. This provides a direct link to the official online presence. ```php $website = $place->getWebsite(); ``` -------------------------------- ### Get Step Start Location (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves the starting coordinate for a specific step. This is represented by a Coordinate object. ```php $startLocation = $step->getStartLocation(); ``` -------------------------------- ### Build Rectangle with Bound and Options (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/overlay/rectangle.md Shows how to initialize a Rectangle with a Bound and an array of options. The options can be used to configure properties like 'clickable' directly during construction. ```php use Ivory\GoogleMap\Base\Base; use Ivory\GoogleMap\Base\Coordinate; use Ivory\GoogleMap\Overlay\Rectangle; $rectangle = new Rectangle( new Bound( new Coordinate(-1, -1), new Coordinate(1, 1) ), ['clickable' => false] ); ``` -------------------------------- ### Get Address Components Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/place/base/place.md Retrieves an array of separate address components that form the place's address. This allows for granular access to address details. ```php $addressComponents = $place->getAddressComponents(); ``` -------------------------------- ### Configure Project Environment Variables Source: https://github.com/bresam/ivory-google-map/blob/master/doc/development_environment.md Copies default configuration files for environment variables and PHPUnit. Users should then update the 'phpunit.xml' file with their specific credentials. This step is crucial before building or running the project. ```bash cp .env.dist .env cp phpunit.xml.dist phpunit.xml ``` -------------------------------- ### Configure Message Factory with Guzzle Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/service.md Updates the message factory for services. This example uses Guzzle's message factory, but any HTTPlug-compliant factory can be substituted. ```php use Http\Message\MessageFactory\GuzzleMessageFactory; $service->setMessageFactory(new GuzzleMessageFactory()); ``` -------------------------------- ### Get Place Photos Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/place/base/place.md Retrieves an array of photo objects, each containing a reference to an image associated with the place. Refer to the photo documentation for more details. ```php $photos = $place->getPhotos(); ``` -------------------------------- ### Build InfoWindow with Content (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/overlay/info_window.md Creates a new InfoWindow instance with basic content. This is the fundamental step for displaying information on the map. ```php use Ivory\GoogleMap\Overlay\InfoWindow; $infoWindow = new InfoWindow('content'); ``` -------------------------------- ### Build a Google Map Instance Source: https://github.com/bresam/ivory-google-map/blob/master/doc/map.md Initializes a new Google Map object. This is the first step to rendering a map. No external dependencies are required beyond the Ivory Google Map library itself. ```php use Ivory\GoogleMap\Map; $map = new Map(); ``` -------------------------------- ### Get Prediction Match Offset Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/place/autocomplete/place_autocomplete_response.md Retrieves the starting offset of a matched term within the prediction result text. This indicates the position where the match begins. ```php $offset = $match->getOffset(); ``` -------------------------------- ### Get Rating from Review (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/place/base/review.md Retrieves the user's overall rating for the place. The rating is a numerical value ranging from 1 to 5. ```php $rating = $review->getRating(); ``` -------------------------------- ### Get Prediction Term Offset Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/place/autocomplete/place_autocomplete_response.md Retrieves the starting offset of a term within the prediction's description. This indicates the position of the term in Unicode characters. ```php $offset = $term->getOffset(); ``` -------------------------------- ### Build InfoWindow with Advanced Options (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/overlay/info_window.md Constructs an InfoWindow with specified content, type, and initial position. Allows for more precise control over the InfoWindow's appearance and placement from the start. ```php use Ivory\GoogleMap\Base\Coordinate; use Ivory\GoogleMap\Overlay\InfoWindow; use Ivory\GoogleMap\Overlay\InfoWindowType; $infoWindow = new InfoWindow('content', InfoWindowType::INFO_BOX, new Coordinate()); ``` -------------------------------- ### Get Prediction Types Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/place/autocomplete/place_autocomplete_response.md Retrieves an array of tags identifying the type of feature returned in the prediction result. For example, 'locality' for a city or 'political' for a political entity. ```php $types = $prediction->getTypes(); ``` -------------------------------- ### Build an Icon Object (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/overlay/icon.md Demonstrates how to instantiate an Icon object in PHP. The constructor can optionally accept parameters for URL, anchor, origin, scaled size, and size. ```php use Ivory\GoogleMap\Overlay\Icon; $icon = new Icon(); ``` ```php use Ivory\GoogleMap\Base\Point; use Ivory\GoogleMap\Base\Size; use Ivory\GoogleMap\Overlay\Icon; $icon = new Icon( Icon::DEFAULT_URL, new Point(20, 34), new Point(0, 0), new Size(20, 34), new Size(40, 68) ); ``` -------------------------------- ### Build GeoJSON Layer with URL and Options (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/layer/geo_json_layer.md Shows how to instantiate a GeoJsonLayer with both the GeoJSON data URL and an array of configuration options. This allows for immediate customization upon creation. ```php use Ivory\GoogleMap\Layer\GeoJsonLayer; $geoJsonLayer = new GeoJsonLayer( 'https://storage.googleapis.com/mapsdevsite/json/google.json', ['idPropertyName' => 'id'] ); ``` -------------------------------- ### Get Available Travel Modes (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves an array of available travel modes for the given waypoints. This is useful when a request specifies a travel mode but gets no results. ```php $availableTravelModes = $response->getAvailableTravelModes(); ``` -------------------------------- ### Run PHPUnit Tests Source: https://github.com/bresam/ivory-google-map/blob/master/doc/development_environment.md Executes the PHPUnit test suite within the running Docker container. This command is used to verify the project's functionality and identify any issues. ```bash docker exec ivory-google-map_php_1 vendor/bin/phpunit ``` -------------------------------- ### Build a Detailed Marker with All Options Source: https://github.com/bresam/ivory-google-map/blob/master/doc/overlay/marker.md Shows how to construct a marker with all possible parameters, including animation, icon, symbol, shape, and additional options. If both an icon and a symbol are provided, the icon takes precedence. ```php use Ivory\GoogleMap\Base\Coordinate; use Ivory\GoogleMap\Overlay\Animation; use Ivory\GoogleMap\Overlay\Icon; use Ivory\GoogleMap\Overlay\Marker; use Ivory\GoogleMap\Overlay\MarkerShape; use Ivory\GoogleMap\Overlay\MarkerShapeType; use Ivory\GoogleMap\Overlay\Symbol; use Ivory\GoogleMap\Overlay\SymbolPath; $marker = new Marker( new Coordinate(), Animation::BOUNCE, new Icon(), new Symbol(SymbolPath::CIRCLE), new MarkerShape(MarkerShapeType::CIRCLE, [1.1, 2.1, 1.4]), ['clickable' => false] ); ``` -------------------------------- ### Get Next Page Token for Place Search Pagination (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/place/search/place_search_response.md This code demonstrates how to get the next page token from a PlaceSearchResponse in PHP. This token is used internally by the iterator to handle pagination of search results. ```php $nextPageToken = $response->getNextPageToken(); ``` -------------------------------- ### Build Circle with Default Options Source: https://github.com/bresam/ivory-google-map/blob/master/doc/overlay/circle.md Demonstrates how to create a new Circle object with a default coordinate for its center. This is the basic initialization for a circle. ```php use Ivory\GoogleMap\Base\Coordinate; use Ivory\GoogleMap\Overlay\Circle; $circle = new Circle(new Coordinate()); ``` -------------------------------- ### Install Ivory Google Map Bundle for Symfony Source: https://github.com/bresam/ivory-google-map/blob/master/README.md This command installs the Ivory Google Map Bundle for Symfony using Composer. This bundle provides integration with the Symfony framework, simplifying map management within Symfony applications. ```bash composer require ivory/google-map-bundle ``` -------------------------------- ### Build Fullscreen Control - PHP Source: https://github.com/bresam/ivory-google-map/blob/master/doc/control/fullscreen.md Demonstrates how to instantiate a FullscreenControl object in PHP. The constructor can optionally accept a ControlPosition argument to set the initial placement of the control on the map. ```php use Ivory\GoogleMap\Control\FullscreenControl; $fullscreenControl = new FullscreenControl(); ``` ```php use Ivory\GoogleMap\Control\ControlPosition; use Ivory\GoogleMap\Control\FullscreenControl; $fullscreenControl = new FullscreenControl(ControlPosition::TOP_LEFT); ``` -------------------------------- ### Build Circle with Custom Radius and Options Source: https://github.com/bresam/ivory-google-map/blob/master/doc/overlay/circle.md Shows how to instantiate a Circle object with a specified radius and an array of options. The options allow for customization of the circle's appearance and behavior. ```php use Ivory\GoogleMap\Base\Coordinate; use Ivory\GoogleMap\Overlay\Circle; $circle = new Circle(new Coordinate(), 10, ['clickable' => false]); ``` -------------------------------- ### Get End Address (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves the human-readable street address for the end location of a leg. ```php $endAddress = $leg->getEndAddress(); ``` -------------------------------- ### Get End Location (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves the ending coordinate of a leg. This is represented by a Coordinate object. ```php $endLocation = $leg->getEndLocation(); ``` -------------------------------- ### Build Polyline with Parameters - PHP Source: https://github.com/bresam/ivory-google-map/blob/master/doc/overlay/polyline.md Shows how to build a Polyline object with initial coordinates, icon sequences, and options using the constructor in PHP. This allows for immediate configuration upon creation. ```php use Ivory\GoogleMap\Base\Coordinate; use Ivory\GoogleMap\Overlay\IconSequence; use Ivory\GoogleMap\Overlay\Polyline; use Ivory\GoogleMap\Overlay\Symbol; use Ivory\GoogleMap\Overlay\SymbolPath; $polyline = new Polyline( [ new Coordinate(25.774, -80.190), new Coordinate(18.466, -66.118), new Coordinate(32.321, -64.757), new Coordinate(25.774, -80.190), ], [ new IconSequence(new Symbol(SymbolPath::FORWARD_OPEN_ARROW)), ], ['fillOpacity' => 0.5] ); ``` -------------------------------- ### Build Static Map Helper - PHP Source: https://github.com/bresam/ivory-google-map/blob/master/doc/helper/static_map.md Initializes and builds a static map helper using Ivory's StaticMapHelperBuilder. This is the first step to rendering static Google Maps. It requires the Ivory Google Map library. ```php use Ivory\GoogleMap\Helper\Builder\StaticMapHelperBuilder; $staticMapHelperBuilder = StaticMapHelperBuilder::create(); $staticMapHelper = $staticMapHelperBuilder->build(); ``` -------------------------------- ### Get Route Warnings (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves an array of warnings associated with the route that should be displayed to the user. ```php $warnings = $route->getWarnings(); ``` -------------------------------- ### Build Heatmap Layer (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/layer/heatmap_layer.md Initializes a new HeatmapLayer object. The constructor can optionally accept an array of Coordinates and an array of options for initial configuration. If no arguments are provided, default empty arrays are used. ```php use Ivory\GoogleMap\Layer\HeatmapLayer; $heatmapLayer = new HeatmapLayer(); ``` -------------------------------- ### Get Route Summary (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves a short textual description of the route, suitable for display. ```php $summary = $route->getSummary(); ``` -------------------------------- ### Build API Helper - PHP Source: https://github.com/bresam/ivory-google-map/blob/master/doc/helper/api.md Demonstrates how to build an API helper using ApiHelperBuilder in PHP. This is the initial step for API rendering, allowing configuration of various aspects like JSON builder, formatter, API key, language, and subscribers. ```php use Ivory\GoogleMap\Helper\Builder\ApiHelperBuilder; $apiHelperBuilder = ApiHelperBuilder::create(); $apiHelper = $apiHelperBuilder->build(); ``` -------------------------------- ### Get Route Fare (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves the total fare for the route, if available and applicable for transit requests. ```php $fare = $route->getFare(); ``` -------------------------------- ### Get Route Copyrights (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves the copyright information for the route. This text must be displayed by the user. ```php $copyrights = $route->getCopyrights(); ``` -------------------------------- ### Get Geocoded Waypoints (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves an array containing details about the geocoding of origin, destination, and waypoints. ```php $geocodedWaypoints = $response->getGeocodedWaypoints(); ``` -------------------------------- ### Build Scale Control - PHP Source: https://github.com/bresam/ivory-google-map/blob/master/doc/control/scale.md Demonstrates how to create a new ScaleControl object. The constructor can optionally accept position and style parameters. ```php use Ivory\GoogleMap\Control\ScaleControl; $scaleControl = new ScaleControl(); ``` ```php use Ivory\GoogleMap\Control\ControlPosition; use Ivory\GoogleMap\Control\ScaleControl; use Ivory\GoogleMap\Control\ScaleControlStyle; $scaleControl = new ScaleControl( ControlPosition::BOTTOM_LEFT, ScaleControlStyle::DEFAULT_ ); ``` -------------------------------- ### Get Geometry Location Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/base/geometry.md Retrieves the location of the geometry as a Coordinate object. This method is part of the Geometry class. ```php $location = $geometry->getLocation(); ``` -------------------------------- ### Build Polyline - PHP Source: https://github.com/bresam/ivory-google-map/blob/master/doc/overlay/polyline.md Demonstrates how to instantiate a Polyline object in PHP. The constructor can optionally accept initial coordinates, icon sequences, and options. ```php use Ivory\GoogleMap\Overlay\Polyline; $polyline = new Polyline(); ``` -------------------------------- ### Build a Basic Marker Source: https://github.com/bresam/ivory-google-map/blob/master/doc/overlay/marker.md Demonstrates the basic construction of a marker using its coordinate. The constructor requires a Coordinate object to define the marker's position. ```php use Ivory\GoogleMap\Base\Coordinate; use Ivory\GoogleMap\Overlay\Marker; $marker = new Marker(new Coordinate()); ``` -------------------------------- ### Build Place Detail Service (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/place/detail/place_detail.md Initializes the PlaceDetailService with an HTTP client and message factory. It relies on Httplug for HTTP communication and supports various client implementations. The constructor requires an HttpClient and a MessageFactory. ```php use Ivory\GoogleMap\Service\Place\Detail\PlaceDetailService; use Http\Adapter\Guzzle7\Client; use Http\Message\MessageFactory\GuzzleMessageFactory; $detail = new PlaceDetailService(new Client(), new GuzzleMessageFactory()); ``` -------------------------------- ### Get Step Instructions (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves the formatted instructions for a specific step, provided as an HTML text string. ```php $instructions = $step->getInstructions(); ``` -------------------------------- ### Get Step End Location (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves the ending coordinate for a specific step. This is represented by a Coordinate object. ```php $endLocation = $step->getEndLocation(); ``` -------------------------------- ### Build GeoJSON Layer with URL (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/layer/geo_json_layer.md Demonstrates how to create a new GeoJsonLayer instance by providing a URL to the GeoJSON data. This is the initial step for rendering geospatial data on a map. ```php use Ivory\GoogleMap\Layer\GeoJsonLayer; $geoJsonLayer = new GeoJsonLayer('https://storage.googleapis.com/mapsdevsite/json/google.json'); ``` -------------------------------- ### Get Leg Duration (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves the Duration object representing the total duration of a specific leg of the route. ```php $duration = $leg->getDuration(); ``` -------------------------------- ### Get Route Bound (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves the bound object, which defines the viewport bounding box for a specific route. ```php $bound = $route->getBound(); ``` -------------------------------- ### Build Icon Sequence with Symbols and Options - PHP Source: https://github.com/bresam/ivory-google-map/blob/master/doc/overlay/icon_sequence.md Shows how to create an IconSequence in PHP, providing both an array of symbols and an options array to the constructor. This allows for immediate configuration of properties like 'offset'. ```php use Ivory\GoogleMap\Overlay\IconSequence; use Ivory\GoogleMap\Overlay\Symbol; use Ivory\GoogleMap\Overlay\SymbolPath; $iconSequence = new IconSequence( [new Symbol(SymbolPath::FORWARD_OPEN_ARROW)], ['offset' => '100%'] ); ``` -------------------------------- ### Get Place Geometry Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/place/base/place.md Retrieves technical geographic information about the place. For more details, refer to the geometry documentation. ```php $geometry = $place->getGeometry(); ``` -------------------------------- ### Build Zoom Control - PHP Source: https://github.com/bresam/ivory-google-map/blob/master/doc/control/zoom.md This snippet demonstrates how to instantiate a new Zoom Control object in PHP. The constructor can optionally accept parameters for position and style. ```php use Ivory\GoogleMap\Control\ZoomControl; $zoomControl = new ZoomControl(); ``` ```php use Ivory\GoogleMap\Control\ControlPosition; use Ivory\GoogleMap\Control\ZoomControl; use Ivory\GoogleMap\Control\ZoomControlStyle; $zoomControl = new ZoomControl( ControlPosition::TOP_LEFT, ZoomControlStyle::DEFAULT_ ); ``` -------------------------------- ### Build Rotate Control (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/control/rotate.md Demonstrates how to instantiate a Rotate Control object in PHP. The constructor can optionally accept a ControlPosition argument to set the initial placement of the control on the map. ```php use Ivory\GoogleMap\Control\RotateControl; $rotateControl = new RotateControl(); ``` ```php use Ivory\GoogleMap\Control\ControlPosition; use Ivory\GoogleMap\Control\RotateControl; $rotateControl = new RotateControl(ControlPosition::TOP_LEFT); ``` -------------------------------- ### Get Formatted Address Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/place/base/place.md Retrieves the complete human-readable address of the place. This string includes all components of the address. ```php $formattedAddress = $place->getFormattedAddress(); ``` -------------------------------- ### Get Place Name Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/place/base/place.md Retrieves the human-readable name of the place. This is the primary name displayed for the search result. ```php $name = $place->getName(); ``` -------------------------------- ### Build Heatmap Layer with Coordinates and Options (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/layer/heatmap_layer.md Constructs a HeatmapLayer with initial data points (coordinates) and configuration options. This allows for immediate visualization of heatmap intensity at specified geographical locations with specific rendering properties like 'dissipating'. ```php use Ivory\GoogleMap\Base\Coordinate; use Ivory\GoogleMap\Layer\HeatmapLayer; $heatmapLayer = new HeatmapLayer( [ new Coordinate(37.782551, -122.445368), new Coordinate(37.782745, -122.444586), new Coordinate(37.782842, -122.443688), new Coordinate(37.782919, -122.442815), new Coordinate(37.782992, -122.442112), new Coordinate(37.783100, -122.441461), new Coordinate(37.783206, -122.440829), new Coordinate(37.783273, -122.440324), new Coordinate(37.783316, -122.440023), new Coordinate(37.783357, -122.439794), new Coordinate(37.783371, -122.439687), new Coordinate(37.783368, -122.439666), new Coordinate(37.783383, -122.439594), new Coordinate(37.783508, -122.439525), new Coordinate(37.783842, -122.439591), // ... ], ['dissipating' => true] ); ``` -------------------------------- ### Get Review Submission Time (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/place/base/review.md Retrieves the time when the review was submitted. The returned value is a DateTime object. ```php $time = $review->getTime(); ``` -------------------------------- ### Build Street View Control (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/control/street_view.md Demonstrates how to instantiate a Street View control object using the Ivory Google Map library. The constructor can optionally accept a control position. ```php use Ivory\GoogleMap\Control\StreetViewControl; $streetViewControl = new StreetViewControl(); ``` ```php use Ivory\GoogleMap\Control\ControlPosition; use Ivory\GoogleMap\Control\StreetViewControl; $streetViewControl = new StreetViewControl(ControlPosition::TOP_LEFT); ``` -------------------------------- ### Get Leg Distance (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves the Distance object representing the total distance covered by a specific leg of the route. ```php $duration = $leg->getDistance(); ``` -------------------------------- ### Get Route Overview Polyline (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves the encoded polyline string representing the route's overview path. ```php $overviewPolyline = $route->getOverviewPolyline(); ``` -------------------------------- ### Configure Google Maps Event Properties (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/event.md Provides examples for configuring individual properties of a Google Maps event instance. This includes setting the target instance, event name, JavaScript handle, and the capture flag. ```php $event->setInstance($instance); ``` ```php $event->setEventName($eventName); ``` ```php $event->setHandle($handle); ``` ```php $event->setCapture(true); ``` -------------------------------- ### Build Basic Symbol (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/overlay/symbol.md Demonstrates how to create a basic symbol using the SymbolPath::CIRCLE constant in PHP. This is the initial step for rendering a symbol on a map. ```php use Ivory\GoogleMap\Overlay\Symbol; use Ivory\GoogleMap\Overlay\SymbolPath; $symbol = new Symbol(SymbolPath::CIRCLE); ``` -------------------------------- ### Get Route Legs (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves an array of leg objects for the route. Each leg represents a segment between waypoints or the destination. ```php $legs = $route->getLegs(); ``` -------------------------------- ### Get Place Scope Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/place/base/place.md Retrieves the scope of the place, indicating its nature. The available values are defined by the PlaceScope constants. ```php $scope = $place->getScope(); ``` -------------------------------- ### Configure InfoWindow Open State (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/overlay/info_window.md Determines whether the InfoWindow is visible when the map initially loads. Setting this to true makes the InfoWindow appear by default. ```php $infoWindow->setOpen(true); ``` -------------------------------- ### Get Transit Agency URL - PHP Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_transit_details.md Fetches the URL for the transit agency from a DirectionTransitAgency object. ```php $url = $agency->getUrl(); ``` -------------------------------- ### Configure Rectangle Option (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/overlay/rectangle.md Illustrates how to set individual options for a Rectangle object after its creation using the `setOption` method. This allows for dynamic configuration of properties like 'clickable'. ```php $rectangle->setOption('clickable', false); ``` -------------------------------- ### Get Transit Agency Name - PHP Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_transit_details.md Extracts the name of the transit agency from a DirectionTransitAgency object. ```php $name = $agency->getName(); ``` -------------------------------- ### Build a Polygon Object Source: https://github.com/bresam/ivory-google-map/blob/master/doc/overlay/polygon.md Demonstrates the basic construction of a Polygon object. The constructor can optionally accept an array of coordinates and an options array. ```php use Ivory\GoogleMap\Overlay\Polygon; $polygon = new Polygon(); ``` ```php use Ivory\GoogleMap\Base\Coordinate; use Ivory\GoogleMap\Overlay\Polygon; $polygon = new Polygon( [ new Coordinate(25.774, -80.190), new Coordinate(18.466, -66.118), new Coordinate(32.321, -64.757), new Coordinate(25.774, -80.190), ], ['fillOpacity' => 0.5] ); ``` -------------------------------- ### Get Geometry Viewport Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/base/geometry.md Retrieves the recommended viewport for the returned result as a Bound object. This is useful for displaying the geometry on a map. ```php $viewport = $geometry->getViewport(); ``` -------------------------------- ### Get Step Encoded Polyline (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves the encoded polyline representation of a specific step, used for drawing the route on a map. ```php $encodedPolyline = $step->getEncodedPolyline(); ``` -------------------------------- ### Configure Debugging - PHP Source: https://github.com/bresam/ivory-google-map/blob/master/doc/helper/api.md Demonstrates how to enable and configure debugging for the generated code using the ApiHelperBuilder's formatter in PHP. This helps in easily debugging the output. ```php $apiHelperBuilder->getFormatter()->setDebug(true); $apiHelperBuilder->getFormatter()->setIndentationStep(4); ``` -------------------------------- ### Get Step Distance (PHP) Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/direction/direction_response.md Retrieves the distance covered by a specific step until the next step. This field can be null if the distance is unknown. ```php $distance = $step->getDistance(); ``` -------------------------------- ### Get Place Types Source: https://github.com/bresam/ivory-google-map/blob/master/doc/service/place/base/place.md Retrieves an array of feature types that describe the place. The available types are defined by the PlaceType constants. ```php $types = $place->getTypes(); ``` -------------------------------- ### Create Basic Google Map with PHP Source: https://context7.com/bresam/ivory-google-map/llms.txt This snippet demonstrates how to create a basic Google Map instance using the Ivory Google Map library. It configures the map's center, zoom level, map type, and container styling. It also shows how to build and render the necessary HTML and JavaScript for map display using helper builders. ```php use Ivory\GoogleMap\Base\Coordinate; use Ivory\GoogleMap\Helper\Builder\ApiHelperBuilder; use Ivory\GoogleMap\Helper\Builder\MapHelperBuilder; use Ivory\GoogleMap\Map; use Ivory\GoogleMap\MapTypeId; // Create a new map instance $map = new Map(); // Configure the map $map->setHtmlId('my_map_canvas'); $map->setAutoZoom(false); $map->setCenter(new Coordinate(48.8566, 2.3522)); // Paris coordinates $map->setMapOption('zoom', 12); $map->setMapOption('mapTypeId', MapTypeId::ROADMAP); // Configure map container styling $map->setStylesheet('width', '800px'); $map->setStylesheet('height', '600px'); $map->setHtmlAttribute('class', 'google-map-container'); // Build the helpers $mapHelper = MapHelperBuilder::create()->build(); $apiHelper = ApiHelperBuilder::create() ->setKey('YOUR_GOOGLE_MAPS_API_KEY') ->setLanguage('en') ->build(); // Render the map echo $mapHelper->render($map); // Outputs: