Download the PHP package mapsight/tile-proxy without Composer

On this page you can find all versions of the php package mapsight/tile-proxy. 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 tile-proxy

Tile proxy

Tile proxy is a PHP-based server for processing and caching tiles.

Usage

You can initialize the proxy by providing a configuration array or by pointing to a JSONC (JSON with comments) configuration file.

Initialization

Use Proxy when a single config serves both raster tile pipelines and Mapbox style assets. It routes style asset requests under mapAssetBasePath to MapboxStyleProxy and everything else with an ops pipeline to Base.

Combined or JSONC configuration

Raster tiles only

Mapbox style assets only

Using array configuration

Both Proxy, Base, and MapboxStyleProxy::run() send HTTP status, cache, and content headers automatically. Use MapboxStyleProxy::handleRequest() or Base::handleTileRequest() when you need the HttpResponse object without sending output.

Configuration

The configuration defines the behavior of the proxy.

Combined raster tiles and Mapbox styles

Use one JSONC file and Proxy::runFromJsonConfigFile() when you need both bitmap tiles and Mapbox/MapLibre style assets. Root-level settings such as cacheServerPath, upstreamHttp, and logErrors apply to both modes.

Proxy routes by request path:

Raster tiles use x, y, and z query parameters. Mapbox assets use path segments under mapAssetBasePath. Keep those URL spaces separate so Proxy can pick the right handler.

Upstream HTTP settings

Both the tile src operation and MapboxStyleProxy use the same optional upstreamHttp configuration for outbound requests. HTTP(S) fetches go through Guzzle; file:// URLs are read from disk. Supported keys map to Guzzle request options: proxy, timeout, connect_timeout, allow_redirects, and headers.

For tile pipelines, set upstreamHttp at the root of the config. A src operation can override it with its own upstreamHttp block.

Error logging

Most failures are handled gracefully in HTTP responses, but are otherwise silent unless logging is enabled.

When logErrors is true, or a PSR-3 logger is wired via Log::setLogger(), the library logs:

HTTP 4xx client errors and missing upstream tiles are not logged by default.

Enable PHP error_log output in config:

For production, wire a PSR-3 compatible logger before handling requests. The library calls warning() for upstream issues and error() for request handler failures.

Plain PHP entry file with Monolog

Install Monolog in your project (composer require monolog/monolog), then use a small front script such as public/tile-proxy.php:

Point your web server at that script (or at index.php if you inline the same setup there). Logging to php://stderr works well in Docker; use a file path such as /var/log/tile-proxy.log on a normal VM instead.

Symfony app logger in a dedicated entry script

Symfony already provides a PSR-3 logger (Monolog). Because Proxy::run() sends headers and body itself, call it from a dedicated entry script rather than returning a Symfony Response:

Route /tiles or /map-assets directly to that script in nginx or Apache. In a Symfony controller action the same logger wiring works, but you would need to capture output yourself via Base::handleTileRequest() or MapboxStyleProxy::handleRequest() instead of Proxy::run().

Failed upstream fetches also expose a short reason on UpstreamFetchResult::$error when you call UpstreamFetcher directly.

Operation Pipeline (Chaining)

Operations are chained sequentially as defined in the ops array. The first operation must be the src operation, which defines the source URL(s).

Available Operations

Any operation may include an optional prefixes array. When set, the operation runs only when the resolved tile prefix (from prefixArgName / defaultPrefix) is listed. This applies to sub-pipelines inside merge as well.

Mapbox Style Vector Proxy

MapboxStyleProxy proxies named Mapbox/MapLibre style assets through same-origin URLs. It rewrites style JSON references for TileJSON, vector tiles, sprites, and glyphs, resolves relative asset URLs, then fetches only allow-listed upstream URLs on demand.

For custom response handling:

Example configuration:

Request the proxied style at:

Generated asset routes use the same base path:

Examples

Layering Tiles

You can layer tiles by using the merge operation to overlay another tile set on top of the base map. If the overlay request fails (e.g., returns a 404), the merge operation is skipped and the base tile is returned.

Prefix-specific operations

Use prefixes to run an operation only for certain map styles. For example, apply a color filter to the base map before merging an overlay when prefix=muted:

Development

Testing

To run the tests, use:

Or run PHPUnit directly:

The basemap.de integration test is skipped by default because it depends on the live upstream service. Run it explicitly with:

License

This project is MIT.

For licensing or trademark questions, contact [email protected].

Community

Participation in Mapsight community spaces is governed by our Code of Conduct (Contributor Covenant 3.0).


All versions of tile-proxy with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2.0
ext-gd Version *
ext-json Version *
guzzlehttp/guzzle Version ^7.0
spatie/image-optimizer Version ^1.8.1
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 mapsight/tile-proxy contains the following files

Loading the files please wait ...