Download the PHP package cyrildewit/php-maps-urls without Composer

On this page you can find all versions of the php package cyrildewit/php-maps-urls. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-maps-urls

PHP Google Maps URLs

Packagist run-tests StyleCI Codecov branch Total Downloads License

This package allows you to build URLs for the Google Maps URLs API.

Here's a quick example:

Overview

This package provides a convenient way to generate URLs for the Google Maps URLs API. Each action has its own abstraction that can be used to generate a URL. For more information about this API, head over to the Google Maps URLs API documentation.

Documentation

Table of contents

  1. Getting Started
    • Requirements
    • Installation
  2. Usage
    • Generating a URL
    • Actions
      • Search
      • Directions
      • Displaying a map
      • Display a Street View panorama
  3. Credits
  4. License

Getting Started

Requirements

This package requires PHP 7.4+.

Version information

Version Status PHP Version
^1.0 Active support ^7.4 and ^8.0
^0.0 End of life ^7.0

Installation

You can install this package via Composer using:

Usage

Generating a URL

The CyrildeWit\MapsUrls\UrlGenerator class is responsible for generation the URLs. The constructor accepts an instance of an action class. Action classes extends CyrildeWit\MapsUrls\Actions\AbstractAction.

Output $searchUrl: https://www.google.com/maps/search/?api=1&query=Eindhoven,%20Nederland

Actions

The Google Maps URLs API allows you to generate a URL that performs a certain actions. These actions can be configured by using one of the provided action classes.

Search

From the official documentation: "Launch a Google Map that displays a pin for a specific place, or perform a general search and launch a map to display the results."

Query

To set the query of the search action, you can call the setQuery(string $query) method.

The query parameter may also consist of latitude/longitude coordinates. You can add them together yourself or make use of the setCoordinates(float $latitude, float $longitude) method.

Query Place ID

If you want to specify the optional place ID for a search action, you can add it using the setQueryPlaceId(string $placeId) method.

Magic make constructor

To instantiate a search action with initial query parameters values, you can make use of the magic SearchAction::make(array $options) method.

Directions

From the official documentation: "Request directions and launch Google Maps with the results."

Origin

The origin can be defined using method setOrigin(string $origin).

Origin Place ID

The origin place ID can be defined using method setOriginPlaceId(string $placeId).

Destination

The destination can be defined using method setDestination(string $destination).

Destination Place ID

The destination place ID can be defined using method setDestinationPlaceId(string $placeId).

Travel Mode

The travel mode can be defined using method setTravelMode(string $travelmode). The valid options are:

These options can be referenced using the constants defined in CyrildeWit\MapsUrls\Enums\TravelMode.

Example:

The CyrildeWit\MapsUrls\Exceptions\InvalidTravelMode exception will be thrown when an invalid travel mode is provided.

Direction Action

The direction action can be defined using method setDirectionAction(string $directionAction). The only valid option is navigate. You can use the NAVIGATE constant in DirectionAction class for convenience.

The CyrildeWit\MapsUrls\Exceptions\InvalidDirectionAction exception will be thrown when an invalid direction action is provided.

Waypoints

The waypoints can be defined using method setWaypoints(array $waypoints).

Waypoint place IDs

Waypoint place IDs can be defined using method setWaypointPlaceIds(array $placeIds).

Magic make constructor

To instantiate a directions action with initial query parameters values, you can make use of the magic DirectionsAction::make(array $options) method.

Displaying a map

From the official documentation: "Launch Google Maps with no markers or directions."

Map action

The map_action query parameter is required and is therefore added by default with value map.

Center

The center of the map can be defined by setting the coordinates using method setCenter(float $latitude, float $longitude).

Zoom

The zoom level of the map can be defined by using method setZoom(int $zoom).

Base Map

The base map can be defined using method setBaseMap(string $baseMap). The valid options are:

These options can be referenced using the constants defined in CyrildeWit\MapsUrls\Enums\TravelMode.

Example:

The CyrildeWit\MapsUrls\Exceptions\InvalidBaseMap exception will be thrown when an invalid base map is provided.

Layer

The layer can be defined using method setLayer(string $layer). The valid options are:

These options can be referenced using the constants defined in CyrildeWit\MapsUrls\Enums\Layer.

Example:

The CyrildeWit\MapsUrls\Exceptions\InvalidLayer exception will be thrown when an invalid layer is provided.

Magic make constructor

To instantiate a display street view panorama action with initial query parameters values, you can make use of the magic DirectionsAction::make(array $options) method.

Display a Street View panorama

From the official documentation: "Launch an interactive panorama image."

Map action

The map_action query parameter is required and is therefore added by default with value pano.

Viewpoint

The viewpoint can be defined using method setViewpoint(float $latitude, float $longitude).

Panorama ID

The panorama ID can be defined using method setPanoramaId(string $id).

Heading

The heading can be defined using method setHeading(int $degrees). Only values from 180 to 360 degrees are expected.

The CyrildeWit\MapsUrls\Exceptions\InvalidHeading exception will be thrown when an invalid heading is provided.

Pitch

The pitch can be defined using method setPitch(int $degrees). Only values from -90 to 80 degrees are expected.

The CyrildeWit\MapsUrls\Exceptions\InvalidPitch exception will be thrown when an invalid heading is provided.

Fov

The pitch can be defined using method setFov(int $degrees). Only values from -10 to 100 degrees are expected.

The CyrildeWit\MapsUrls\Exceptions\InvalidFov exception will be thrown when an invalid heading is provided.

Magic make constructor

To instantiate a display street view panorama action with initial query parameters values, you can make use of the magic DirectionsAction::make(array $options) method.

Credits

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details.


All versions of php-maps-urls with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cyrildewit/php-maps-urls contains the following files

Loading the files please wait ....