Skip to content

Commit c4b3ff1

Browse files
committed
chore(mapbox): drop v5 fixtures; docs(mapbox): document v6 upgrade (2.0.0)
1 parent 174081d commit c4b3ff1

20 files changed

Lines changed: 84 additions & 11 deletions

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Provider | Package | Features | Stats
134134
[GraphHopper](https://github.com/geocoder-php/graphhopper-provider) | `geocoder-php/graphhopper-provider` | address, reverse <br> [Website](https://docs.graphhopper.com/#tag/Geocoding-API) | [![Latest Stable Version](https://poser.pugx.org/geocoder-php/graphhopper-provider/v/stable)](https://packagist.org/packages/geocoder-php/graphhopper-provider) <br>[![Total Downloads](https://poser.pugx.org/geocoder-php/graphhopper-provider/downloads)](https://packagist.org/packages/geocoder-php/graphhopper-provider)
135135
[Here](https://github.com/geocoder-php/here-provider) | `geocoder-php/here-provider` | address, reverse <br> [Website](https://developer.here.com/documentation/geocoder/topics/quick-start-geocode.html) | [![Latest Stable Version](https://poser.pugx.org/geocoder-php/here-provider/v/stable)](https://packagist.org/packages/geocoder-php/here-provider) <br>[![Total Downloads](https://poser.pugx.org/geocoder-php/here-provider/downloads)](https://packagist.org/packages/geocoder-php/here-provider)
136136
[LocationIQ](https://github.com/geocoder-php/locationiq-provider) | `geocoder-php/locationiq-provider` | address, reverse <br> [Website](https://locationiq.org/) | [![Latest Stable Version](https://poser.pugx.org/geocoder-php/locationiq-provider/v/stable)](https://packagist.org/packages/geocoder-php/locationiq-provider) <br>[![Total Downloads](https://poser.pugx.org/geocoder-php/locationiq-provider/downloads)](https://packagist.org/packages/geocoder-php/locationiq-provider)
137-
[Mapbox](https://github.com/geocoder-php/mapbox-provider) | `geocoder-php/mapbox-provider` | address, reverse <br> [Website](https://www.mapbox.com/geocoding/) | [![Latest Stable Version](https://poser.pugx.org/geocoder-php/mapbox-provider/v/stable)](https://packagist.org/packages/geocoder-php/mapbox-provider) <br>[![Total Downloads](https://poser.pugx.org/geocoder-php/mapbox-provider/downloads)](https://packagist.org/packages/geocoder-php/mapbox-provider)
137+
[Mapbox](https://github.com/geocoder-php/mapbox-provider) | `geocoder-php/mapbox-provider` | address, reverse <br> [Website](https://docs.mapbox.com/api/search/geocoding/) | [![Latest Stable Version](https://poser.pugx.org/geocoder-php/mapbox-provider/v/stable)](https://packagist.org/packages/geocoder-php/mapbox-provider) <br>[![Total Downloads](https://poser.pugx.org/geocoder-php/mapbox-provider/downloads)](https://packagist.org/packages/geocoder-php/mapbox-provider)
138138
[MapQuest](https://github.com/geocoder-php/mapquest-provider) | `geocoder-php/mapquest-provider` | address, reverse <br> [Website](http://developer.mapquest.com/web/products/dev-services/geocoding-ws) | [![Latest Stable Version](https://poser.pugx.org/geocoder-php/mapquest-provider/v/stable)](https://packagist.org/packages/geocoder-php/mapquest-provider) <br>[![Total Downloads](https://poser.pugx.org/geocoder-php/mapquest-provider/downloads)](https://packagist.org/packages/geocoder-php/mapquest-provider)
139139
[MapTiler](https://github.com/geocoder-php/maptiler-provider) | `geocoder-php/maptiler-provider` | address, reverse <br> [Website](https://www.maptiler.com/cloud/geocoding/) | [![Latest Stable Version](https://poser.pugx.org/geocoder-php/maptiler-provider/v/stable)](https://packagist.org/packages/geocoder-php/maptiler-provider) <br>[![Total Downloads](https://poser.pugx.org/geocoder-php/maptiler-provider/downloads)](https://packagist.org/packages/geocoder-php/maptiler-provider)
140140
[Nominatim](https://github.com/geocoder-php/nominatim-provider) <br> (OpenStreetMap) | `geocoder-php/nominatim-provider` | address, reverse <br> [Website](http://wiki.openstreetmap.org/wiki/Nominatim) | [![Latest Stable Version](https://poser.pugx.org/geocoder-php/nominatim-provider/v/stable)](https://packagist.org/packages/geocoder-php/nominatim-provider) <br>[![Total Downloads](https://poser.pugx.org/geocoder-php/nominatim-provider/downloads)](https://packagist.org/packages/geocoder-php/nominatim-provider)

‎src/Provider/Mapbox/CHANGELOG.md‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,42 @@
22

33
The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.
44

5+
## 2.0.0
6+
7+
### Added
8+
9+
- Support for the Mapbox Geocoding API v6 (`/search/geocode/v6/forward` and `/search/geocode/v6/reverse`)
10+
- v6 Structured Input: forward queries built from typed address fields via query data — `address_line1`, `address_number`, `street`, `block`, `place`, `region`, `postcode`, `locality`, `neighborhood`. When any of these is present, the query text is not sent.
11+
- `Mapbox::TYPE_STREET` (new v6 type, added to `Mapbox::TYPES`)
12+
- `Mapbox::TYPE_BLOCK` (Japan) and `Mapbox::TYPE_SECONDARY_ADDRESS` (US) constants (not part of `TYPES`: the API only accepts them in the corresponding regional context)
13+
- `Mapbox::STRUCTURED_INPUT_FIELDS` constant
14+
- Query data support: `autocomplete` (replaces `fuzzy_match`), `proximity` (`"lon,lat"` or `"ip"`), `worldview`
15+
- New 4th constructor argument `bool $permanent` (v6 `permanent=true` result storage)
16+
- `MapboxAddress::getMatchCode()` / `withMatchCode()` — v6 Smart Address Match object
17+
- `MapboxAddress::getMatchConfidence()` / `withMatchConfidence()` — `exact`, `high`, `medium` or `low`
18+
- `MapboxAddress::getAccuracy()` / `withAccuracy()` — `rooftop`, `parcel`, `point`, `interpolated`, `approximate` or `intersection`
19+
20+
### Removed
21+
22+
- Support for the Mapbox Geocoding API v5 (`/geocoding/v5/...`) — pin to `geocoder-php/mapbox-provider:^1.5` to stay on v5
23+
- `Mapbox::GEOCODE_ENDPOINT_URL_SSL` and `Mapbox::REVERSE_ENDPOINT_URL_SSL` constants (replaced by `Mapbox::FORWARD_ENDPOINT_URL` / `Mapbox::REVERSE_ENDPOINT_URL`)
24+
- `Mapbox::GEOCODING_MODE_PLACES`, `Mapbox::GEOCODING_MODE_PLACES_PERMANENT` and `Mapbox::GEOCODING_MODES` constants (v6 has no geocoding modes; use the `permanent` constructor argument)
25+
- `Mapbox::TYPE_POI` and `Mapbox::TYPE_POI_LANDMARK` constants (v6 does not geocode POIs; passing them as `location_type` now yields a 422 error from the API)
26+
- `fuzzy_match` query data (v6 has no fuzzy/typo matching; use `autocomplete` for prefix-style matching)
27+
28+
### Changed
29+
30+
- The 4th constructor argument is now `bool $permanent = false` (was `string $geocodingMode`); passing a mode string changes behavior or errors
31+
- `Mapbox::TYPES` no longer contains the POI types and now contains `street`
32+
- Forward requests send the search text as the `q` query parameter instead of in the URL path
33+
- Reverse requests send `longitude` / `latitude` query parameters (was `{lon},{lat}` in the path)
34+
- `MapboxAddress::getId()` returns the v6 `mapbox_id` value (format changed, e.g. `dXJu...` instead of `address.123`)
35+
- `MapboxAddress::getResultType()` values follow the v6 `feature_type` vocabulary (`street` added, `poi`/`poi.landmark` gone)
36+
- Reverse geocoding with a `limit` greater than 1 requires a single `location_type` value (v6 API constraint: multiple types + limit returns a 422 error)
37+
- Forward `limit` is capped at 10 by the v6 API (higher values are silently clamped)
38+
- Invalid access tokens are now answered with HTTP 401 by the API (v5 used 403); both map to `Geocoder\Exception\InvalidCredentials`
39+
- Geocoded data reflects the v6 dataset: coordinates, results and admin-level codes may differ from v5
40+
541
## 1.5.0
642

743
### Added

‎src/Provider/Mapbox/Readme.md‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,46 @@ composer require geocoder-php/mapbox-provider
2020

2121
A valid `Access Token` is required for Mapbox.
2222

23+
### Usage
24+
25+
This provider targets the **Mapbox Geocoding API v6**. If you rely on the v5 API, pin
26+
`geocoder-php/mapbox-provider` to `^1.5`.
27+
28+
```php
29+
$provider = new Mapbox($client, $accessToken);
30+
// optional: country filter (ISO 3166 alpha-2) and permanent result storage
31+
$provider = new Mapbox($client, $accessToken, 'US', true);
32+
33+
// Forward geocoding
34+
$provider->geocodeQuery(GeocodeQuery::create('149 9th St, San Francisco, CA 94103'));
35+
36+
// Forward geocoding with options (query data)
37+
$query = GeocodeQuery::create('washi')
38+
->withData('autocomplete', true) // prefix-style matching (on by default)
39+
->withData('location_type', Mapbox::TYPE_STREET) // or an array of Mapbox::TYPE_* constants
40+
->withData('proximity', '-120.09,47.60') // or 'ip'
41+
->withData('worldview', 'us')
42+
->withData('country', 'US');
43+
44+
// v6 Structured Input: typed fields replace the free-text query (the text is not sent)
45+
$query = GeocodeQuery::create('2595 Lucky John Dr, Park City, UT 84060')
46+
->withData('address_number', '2595')
47+
->withData('street', 'Lucky John Dr')
48+
->withData('place', 'Park City')
49+
->withData('region', 'UT')
50+
->withData('postcode', '84060');
51+
// Any of address_line1, address_number, street, block, place, region, postcode,
52+
// locality, neighborhood triggers Structured Input; autocomplete defaults to false.
53+
54+
// Reverse geocoding
55+
$provider->reverseQuery(ReverseQuery::fromCoordinates(48.8631507, 2.388911));
56+
```
57+
58+
Results are `Geocoder\Provider\Mapbox\Model\MapboxAddress` instances. Besides the regular
59+
address data they expose `getId()`, `getStreetName()`, `getStreetNumber()`,
60+
`getResultType()`, `getFormattedAddress()`, `getNeighborhood()`,
61+
`getMatchCode()` / `getMatchConfidence()` (v6 Smart Address Match) and `getAccuracy()`.
62+
2363
### Contribute
2464

2565
Contributions are very welcome! Send a pull request to the [main repository](https://github.com/geocoder-php/Geocoder) or
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
s:2020:"{"type":"FeatureCollection","features":[{"type":"Feature","id":"dXJuOm1ieGFkcjozOGY3OTg1OC1jNzY0LTQ4ZGUtYTFmMC04NjJjOTM1ZWViMjc","geometry":{"type":"Point","coordinates":[-111.507008,40.6716]},"properties":{"mapbox_id":"dXJuOm1ieGFkcjozOGY3OTg1OC1jNzY0LTQ4ZGUtYTFmMC04NjJjOTM1ZWViMjc","feature_type":"address","full_address":"2595 Lucky John Drive, Park City, Utah 84060, United States","name":"2595 Lucky John Drive","name_preferred":"2595 Lucky John Drive","coordinates":{"longitude":-111.507008,"latitude":40.6716,"accuracy":"rooftop","routable_points":[{"name":"default","latitude":40.6716,"longitude":-111.506529}]},"place_formatted":"Park City, Utah 84060, United States","match_code":{"address_number":"matched","street":"matched","postcode":"matched","place":"matched","region":"matched","locality":"not_applicable","country":"inferred","confidence":"exact"},"context":{"address":{"mapbox_id":"dXJuOm1ieGFkcjozOGY3OTg1OC1jNzY0LTQ4ZGUtYTFmMC04NjJjOTM1ZWViMjc","address_number":"2595","street_name":"Lucky John Drive","name":"2595 Lucky John Drive"},"street":{"mapbox_id":"dXJuOm1ieGFkci1zdHI6MzhmNzk4NTgtYzc2NC00OGRlLWExZjAtODYyYzkzNWVlYjI3","name":"Lucky John Drive"},"neighborhood":{"mapbox_id":"dXJuOm1ieHBsYzpITktzN0E","name":"Park Meadows"},"postcode":{"mapbox_id":"dXJuOm1ieHBsYzpFUjNPN0E","name":"84060"},"place":{"mapbox_id":"dXJuOm1ieHBsYzpEdjlvN0E","name":"Park City","wikidata_id":"Q482993"},"district":{"mapbox_id":"dXJuOm1ieHBsYzpBVlRHN0E","name":"Summit County","wikidata_id":"Q484563"},"region":{"mapbox_id":"dXJuOm1ieHBsYzpCa1Rz","name":"Utah","wikidata_id":"Q829","region_code":"UT","region_code_full":"US-UT"},"country":{"mapbox_id":"dXJuOm1ieHBsYzpJdXc","name":"United States","wikidata_id":"Q30","country_code":"US","country_code_alpha_3":"USA"}}}}],"attribution":"NOTICE: © 2026 Mapbox and its suppliers. All rights reserved. Use of this data is subject to the Mapbox Terms of Service (https://www.mapbox.com/about/maps/). This response and the information it contains may not be retained."}";

‎src/Provider/Mapbox/Tests/.cached_responses/api.mapbox.com_20d856dd6d6ae671b181193de4e52f7fb651fd97‎

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
s:5571:"{"type":"FeatureCollection","features":[{"type":"Feature","id":"dXJuOm1ieHBsYzpBUVRz","geometry":{"type":"Point","coordinates":[-120.094293,48.025005]},"properties":{"mapbox_id":"dXJuOm1ieHBsYzpBUVRz","feature_type":"region","full_address":"Washington, United States","name":"Washington","name_preferred":"Washington","coordinates":{"longitude":-120.094293,"latitude":48.025005},"place_formatted":"United States","bbox":[-124.861672,45.543637,-116.916072,49.002595],"context":{"country":{"mapbox_id":"dXJuOm1ieHBsYzpJdXc","name":"United States","wikidata_id":"Q30","country_code":"US","country_code_alpha_3":"USA"},"region":{"mapbox_id":"dXJuOm1ieHBsYzpBUVRz","name":"Washington","region_code":"WA","region_code_full":"US-WA","wikidata_id":"Q1223"}}}},{"type":"Feature","id":"dXJuOm1ieHBsYzpLU3RzN0E","geometry":{"type":"Point","coordinates":[-120.482925,46.59803]},"properties":{"mapbox_id":"dXJuOm1ieHBsYzpLU3RzN0E","feature_type":"neighborhood","full_address":"Washington Park, Yakima, Washington, United States","name":"Washington Park","name_preferred":"Washington Park","coordinates":{"longitude":-120.482925,"latitude":46.59803},"place_formatted":"Yakima, Washington, United States","bbox":[-120.494858,46.592164,-120.481383,46.601423],"context":{"postcode":{"mapbox_id":"dXJuOm1ieHBsYzpFN1B1N0E","name":"98901"},"place":{"mapbox_id":"dXJuOm1ieHBsYzpGZE1JN0E","name":"Yakima","wikidata_id":"Q499203","alternate":{"mapbox_id":"dXJuOm1ieHBsYzpFKy9vN0E","name":"Union Gap"}},"district":{"mapbox_id":"dXJuOm1ieHBsYzpBWVdHN0E","name":"Yakima County","wikidata_id":"Q156629"},"region":{"mapbox_id":"dXJuOm1ieHBsYzpBUVRz","name":"Washington","wikidata_id":"Q1223","region_code":"WA","region_code_full":"US-WA"},"country":{"mapbox_id":"dXJuOm1ieHBsYzpJdXc","name":"United States","wikidata_id":"Q30","country_code":"US","country_code_alpha_3":"USA"},"neighborhood":{"mapbox_id":"dXJuOm1ieHBsYzpLU3RzN0E","name":"Washington Park"}}}},{"type":"Feature","id":"dXJuOm1ieHBsYzpMcDhzN0E","geometry":{"type":"Point","coordinates":[-123.04517,48.07898]},"properties":{"mapbox_id":"dXJuOm1ieHBsYzpMcDhzN0E","feature_type":"neighborhood","full_address":"Washington Harbor, Sequim, Washington, United States","name":"Washington Harbor","name_preferred":"Washington Harbor","coordinates":{"longitude":-123.04517,"latitude":48.07898},"place_formatted":"Sequim, Washington, United States","bbox":[-123.051913,48.07448,-123.038438,48.083482],"context":{"place":{"mapbox_id":"dXJuOm1ieHBsYzpFY2RJN0E","name":"Sequim","wikidata_id":"Q1514115"},"district":{"mapbox_id":"dXJuOm1ieHBsYzpRTWJz","name":"Clallam County","wikidata_id":"Q156306"},"region":{"mapbox_id":"dXJuOm1ieHBsYzpBUVRz","name":"Washington","wikidata_id":"Q1223","region_code":"WA","region_code_full":"US-WA"},"country":{"mapbox_id":"dXJuOm1ieHBsYzpJdXc","name":"United States","wikidata_id":"Q30","country_code":"US","country_code_alpha_3":"USA"},"neighborhood":{"mapbox_id":"dXJuOm1ieHBsYzpMcDhzN0E","name":"Washington Harbor"}}}},{"type":"Feature","id":"dXJuOm1ieGFkci1zdHI6ZGNjNjFmZjctZDkwZi00N2U5LTg2OGMtNTMyMWFlZWYyZmY5","geometry":{"type":"Point","coordinates":[-123.381214,48.444226]},"properties":{"mapbox_id":"dXJuOm1ieGFkci1zdHI6ZGNjNjFmZjctZDkwZi00N2U5LTg2OGMtNTMyMWFlZWYyZmY5","feature_type":"street","full_address":"Washington Avenue, Victoria, British Columbia V9A 1P7, Canada","name":"Washington Avenue","name_preferred":"Washington Avenue","coordinates":{"longitude":-123.381214,"latitude":48.444226},"place_formatted":"Victoria, British Columbia V9A 1P7, Canada","context":{"street":{"mapbox_id":"dXJuOm1ieGFkci1zdHI6ZGNjNjFmZjctZDkwZi00N2U5LTg2OGMtNTMyMWFlZWYyZmY5","name":"Washington Avenue"},"neighborhood":{"mapbox_id":"dXJuOm1ieHBsYzpNQ3du","name":"Burnside"},"postcode":{"mapbox_id":"dXJuOm1ieHBsYzpBYVlQYmlj","name":"V9A 1P7"},"place":{"mapbox_id":"dXJuOm1ieHBsYzpCMTVJSnc","name":"Victoria","wikidata_id":"Q2132"},"district":{"mapbox_id":"dXJuOm1ieHBsYzpBcVlu","name":"Capital Regional District","wikidata_id":"Q550219"},"region":{"mapbox_id":"dXJuOm1ieHBsYzo1Q2M","name":"British Columbia","wikidata_id":"Q1973","region_code":"BC","region_code_full":"CA-BC"},"country":{"mapbox_id":"dXJuOm1ieHBsYzpJaWM","name":"Canada","wikidata_id":"Q16","country_code":"CA","country_code_alpha_3":"CAN"}}}},{"type":"Feature","id":"address.7607992201284362","geometry":{"type":"Point","coordinates":[-117.039767,46.930253]},"properties":{"mapbox_id":"address.7607992201284362","feature_type":"street","full_address":"Washington Highway 6, Palouse, Washington 99161, United States","name":"Washington Highway 6","name_preferred":"Washington Highway 6","coordinates":{"longitude":-117.039767,"latitude":46.930253},"place_formatted":"Palouse, Washington 99161, United States","context":{"street":{"mapbox_id":"address.7607992201284362","name":"Washington Highway 6"},"postcode":{"mapbox_id":"dXJuOm1ieHBsYzpFOEtPN0E","name":"99161"},"place":{"mapbox_id":"dXJuOm1ieHBsYzpEdkVvN0E","name":"Palouse"},"district":{"mapbox_id":"dXJuOm1ieHBsYzpBWHpHN0E","name":"Whitman County","wikidata_id":"Q484153"},"region":{"mapbox_id":"dXJuOm1ieHBsYzpBUVRz","name":"Washington","wikidata_id":"Q1223","region_code":"WA","region_code_full":"US-WA"},"country":{"mapbox_id":"dXJuOm1ieHBsYzpJdXc","name":"United States","wikidata_id":"Q30","country_code":"US","country_code_alpha_3":"USA"}}}}],"attribution":"NOTICE: © 2026 Mapbox and its suppliers. All rights reserved. Use of this data is subject to the Mapbox Terms of Service (https://www.mapbox.com/about/maps/). This response and the information it contains may not be retained."}";

‎src/Provider/Mapbox/Tests/.cached_responses/api.mapbox.com_436e84f1a3531213304e67e5bca76e7550349a2a‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)