DEV Community

Cover image for Laravel 12 IP Intelligence with a Modern IPStack Service Layer (sudiptpa/ipstack + sudiptpa/guid)
Sujip Thapa
Sujip Thapa

Posted on • Originally published at sujipthapa.com

Laravel 12 IP Intelligence with a Modern IPStack Service Layer (sudiptpa/ipstack + sudiptpa/guid)

I built an IpstackService in Laravel 12 powered by sudiptpa/ipstack, a modern PHP library for typed IP intelligence workflows and production-ready integration patterns.

Full deep-dive tutorial is here:

👉 https://sujipthapa.com/blog/ipstack-laravel-integration

Why this implementation matters

This was not a package demo. I implemented a full feature with:

  • Web + API verification endpoints
  • Service-layer architecture around IpstackService
  • Request traceability via sudiptpa/guid
  • Verification persistence for audit/observability
  • Free-plan-safe behavior for real-world reliability

Stack used

  • sudiptpa/ipstack

    Modern, PSR-friendly PHP library for IPStack lookups (single, requester, optimized, bulk).

  • sudiptpa/guid

    Lightweight GUID generation for request-level trace IDs.

What I shipped in Laravel 12

1. Service-first design

A dedicated IpstackService handles all lookup workflows:

  • Single lookup
  • Requester lookup (/check)
  • Optimized lookup using options (fields, language, plan-safe behavior)
  • Bulk lookup with graceful fallback

2. Real-world free plan handling

Two practical issues were handled in production style:

  • Optimized lookup 400 on free plan

    Fixed by using free-safe defaults unless advanced options are explicitly enabled.

  • Bulk lookup 403 on free plan

    Fixed by fallback to sequential single-IP lookups.

3. Traceable verification records

Each request gets a GUID (verification_guid) and persists result/error context for easier debugging and support.

Endpoints implemented

Web

  • GET /ip-verifications
  • POST /ip-verifications
  • POST /ip-verifications/requester
  • POST /ip-verifications/optimized
  • POST /ip-verifications/bulk

API

  • POST /api/ip-verifications
  • POST /api/ip-verifications/requester
  • POST /api/ip-verifications/optimized
  • POST /api/ip-verifications/bulk

Result

The outcome is a robust Laravel 12 IP intelligence feature using a modern PHP IPStack client, with practical reliability improvements for real plan constraints.

Read the full technical tutorial, code structure, and implementation walkthrough:

👉 https://sujipthapa.com/blog/ipstack-laravel-integration

``
Enter fullscreen mode Exit fullscreen mode

Top comments (0)