Add EU endpoint support and improve API client functionality#9
Merged
jonathan-kosgei merged 2 commits intomasterfrom Feb 24, 2026
Merged
Add EU endpoint support and improve API client functionality#9jonathan-kosgei merged 2 commits intomasterfrom
jonathan-kosgei merged 2 commits intomasterfrom
Conversation
Add caller IP lookup (lookup with no args), EU endpoint support via configurable base URL and Ipdata::EU_BASE_URL constant, and properly named bulkLookup() method with buildLookup() kept as deprecated alias. Fix bulk request Content-Type from text/plain to application/json. https://claude.ai/code/session_017km7GVfNGXQe2UGceb34hf
Neither package was imported or used anywhere in source or tests. symfony/http-client was only implicitly needed to make the auto-discovery test pass; updated that test to instead verify the expected LogicException when no PSR-18 client is installed. https://claude.ai/code/session_017km7GVfNGXQe2UGceb34hf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR enhances the Ipdata API client with support for EU endpoints, improves the lookup functionality, and updates documentation and tests to reflect these changes.
Key Changes
Source Code Improvements
EU_BASE_URLconstant and$baseUrlparameter to constructor, allowing users to route requests through EU servers for GDPR compliancelookup()method to accept an optional IP parameter (defaults to empty string), enabling lookup of the calling IP address when no argument is providedbuildLookup()tobulkLookup()for better naming consistency, withbuildLookup()kept as a deprecated alias for backward compatibilitytext/plaintoapplication/jsonfor correct API specificationBASE_URLconstant with configurable$baseUrlinstance variableTest Coverage
testCallerIpLookup()to verify lookup without IP argumenttestBulkLookup()to verify bulk lookup request structuretestBulkLookupContentType()to verify correct Content-Type headertestCustomBaseUrl()to verify EU endpoint functionalitytestConstructWithDiscovery()totestConstructWithDiscoveryThrowsWhenNoClientAvailable()and updated to verify exception handlingcompany,is_vpn,is_icloud_relay,is_datacenter,blocklists, andscoresDocumentation Updates
buildLookup()→bulkLookup()in README exampleDependencies
php-http/httplugandsymfony/http-clientfrom dev dependencieshttps://claude.ai/code/session_017km7GVfNGXQe2UGceb34hf