Skip to content

feat(mapbox): upgrade Mapbox provider to Geocoding API v6 (2.0.0) - #1274

Open
davidbarratt wants to merge 15 commits into
geocoder-php:masterfrom
geosocio:mapbox-v6
Open

feat(mapbox): upgrade Mapbox provider to Geocoding API v6 (2.0.0) #1274
davidbarratt wants to merge 15 commits into
geocoder-php:masterfrom
geosocio:mapbox-v6

Conversation

@davidbarratt

Copy link
Copy Markdown

Summary

  • Upgrades Geocoder\Provider\Mapbox\Mapbox in place to the Mapbox Geocoding API v6 (/search/geocode/v6/forward and /search/geocode/v6/reverse), as a major version (2.0.0) of geocoder-php/mapbox-provider
  • Adds v6 Structured Input (typed address fields via query data), autocomplete / proximity / worldview query data, a new 4th constructor argument bool $permanent, TYPE_STREET / TYPE_BLOCK / TYPE_SECONDARY_ADDRESS constants, and MapboxAddress::getMatchCode() / getMatchConfidence() / getAccuracy()
  • Removes the v5 endpoints, GEOCODING_MODE_*, TYPE_POI* and fuzzy_match; every breaking change is listed in the provider CHANGELOG 2.0.0 (v5 users: pin to geocoder-php/mapbox-provider:^1.5)

Closes #1237

Test Plan

  • composer test — full suite green (1049 tests); Mapbox: 45 tests incl. 7 v6 integration fixtures + 4 provider-integration fixtures replayed from .cached_responses with the placeholder key (CI-safe)
  • composer analyse — PHPStan level 6 clean
  • composer cs — clean on all touched files
  • TDD throughout: the failing-tests commit (test(mapbox): add failing tests for the v6 API) is followed by the implementation commits that turn the suite green
  • Fixtures recorded against the live v6 API (2026-08-28); all v5 fixtures removed

@davidbarratt

Copy link
Copy Markdown
Author

@jbelien I've run the cs:fix script locally and committed the output, could you run the CI again? Did you have any other comments or feedback? Thanks!

@jbelien

jbelien commented Sep 6, 2026

Copy link
Copy Markdown
Member

I'll try to have a look next week.

@jbelien jbelien left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution.

I've made a first review and here are a few change requests:

  • Please do NOT remove or update any existing tests. Those tests must stay and still pass.
  • Simplify changes made in CHANGELOG.md. Look at the previous tags, no need to go such in small details.
  • Do not rename existing GEOCODE_ENDPOINT_URL_SSL and REVERSE_ENDPOINT_URL_SSL constants, there is no reason to, just change the URL to match the new v6 URLs (long story short: no need to rewrite the whole provider, focus on the changes related to v6 migration).

Thanks.

- Restore the pre-existing tests; only change them where v6 requires it
  (each change is annotated with the reason):
  * v6 has no poi/poi.landmark types: dropped from testGeocodePlaceWithLocale
  * v6 dataset differences: Princes Risborough for 'princ', 12 (not 8)
    Avenue Gambetta for the reverse test, v6 mapbox_id values
  * v6 treats '&' as the intersection search connector, so the
    '116th St & Broadway' query no longer matches any address; the test
    now uses '1600 Pennsylvania Avenue NW, Washington, DC 20500'
  * v6 removed the fuzzyMatch parameter: the two fuzzy tests are now
    autocomplete tests
- Keep the GEOCODE_ENDPOINT_URL_SSL and REVERSE_ENDPOINT_URL_SSL constant
  names; only the URL values move to the v6 endpoints. The provider keeps
  its previous structure, including the constructor signature (the
  mapbox.places-permanent mode maps to the v6 permanent parameter)
- Simplify the CHANGELOG entry to match the style of the previous tags
- Keep the v6 fixtures for both MapboxTest and the shared IntegrationTest
@davidbarratt

Copy link
Copy Markdown
Author

The changes should be minimal now. There are some backwards-incompatible changes with v6, so changing some of the existing tests was required, but it has been notated where that is the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mapbox Geocoding v6

2 participants