Laravel Cloud runtime examples
These examples make route verification repeatable without sending a request to a partner API. They use the existing selected client, a fixed HTTPS echo destination, and a configured expected pair. No example creates a public diagnostic endpoint or accepts an arbitrary destination URL.
Keep the original reference files
The packet preserves config/quotaguard.php, app/Support/QuotaGuardHttp.php, and routes/console-snippet.php. Add them using the technical guide. The optional files below extend the diagnostic workflow rather than replacing those originals.
Compare the echoed address automatically
Add these two files from the packet:
code/config/quotaguard_checks.php
code/app/Support/QuotaGuardEgressProbe.php
Set QUOTAGUARD_EXPECTED_IPV4S to the subscription’s two IPv4 addresses, separated by a comma. Use the real assigned pair. Do not use the documentation addresses from the unit tests. The pair is operational configuration, not a proxy password, but should still be managed with the correct environment rather than copied into unrelated deployments.
The configuration file reads the value through env() at configuration-load time. The probe then checks that there are exactly two distinct valid IPv4 addresses before constructing a request.
Call it from application code:
use App\Support\QuotaGuardEgressProbe;
$ip = app(QuotaGuardEgressProbe::class)->check();
The returned string is a validated address that matched the configured pair. The function makes one fixed GET to the echo service through QuotaGuardHttp. It does not attach a provider token, follow redirects, make a provider API call, or return a raw response body.
The expected pair comparison proves only that the echo request used one of those addresses. A separate provider connection may use the other address. Keep both registered and obtain destination-side evidence for the provider path when available.
Run a real queue diagnostic
Add code/app/Jobs/CheckQuotaGuardEgress.php. Merge code/routes/queue-check-snippet.php into routes/console.php, retaining existing commands and avoiding repeated imports.
Use a real, configured queue connection consumed by the intended worker cluster. The command permits the database, redis, sqs, and beanstalkd drivers and refuses other drivers before dispatch, including sync. A custom driver needs a separate review before extending that list. If the integration uses a named connection or queue, adapt both the validation and dispatch to that same supported queue and verify the worker consumes it. Do not change a production queue’s configuration just to satisfy the example. Calling the job directly with a synchronous dispatch elsewhere still does not validate a worker.
Run:
php artisan quotaguard:check-queue
A dispatch message means the job was submitted, not that it ran. Confirm a quotaguard_egress_check_passed entry in private worker logs and correlate it with the diagnostic run. The entry contains only the queue path label and matched echo IPv4 address. The job makes one attempt; its 40-second worker timeout leaves room around the client’s 30-second overall request timeout. Check that the actual queue retry and visibility settings remain compatible with your existing worker policy. Laravel queue documentation explains timeout coordination.
The probe converts transport failures to a fixed error without retaining a previous exception. This avoids putting a credential-bearing connection URL in a failed-job record. It also means the public example intentionally does not diagnose the exact network failure for you. Investigate privately using the troubleshooting guide.
Check an authenticated web execution path
Use the probe inside an existing internal, authorized diagnostic action or an existing test harness. Do not paste it into a public unauthenticated route. Keep access control, rate limiting, response handling, and logging appropriate to the application.
This confirms a web process can construct the selected client. It does not establish that another controller or SDK used by the business integration does so. Exercise a harmless provider-approved request through that actual service after the echo check.
Check scheduled execution
If scheduled work calls the protected API through a separate service or process, invoke the probe from an operator-approved one-off diagnostic on that execution path. Retain the existing schedule and business logic. Do not add a permanently recurring echo call merely to demonstrate a one-time rollout.
For a scheduled job that dispatches to a queue, record both scheduling and worker completion. The scheduler deciding to enqueue a job is different from the worker making the outbound request.
Add application tests without sending traffic
The packet includes code/tests/Feature/QuotaGuardEgressProbeTest.php, a PHPUnit test class for a Laravel test application with cURL installed. It uses Laravel HTTP fakes and stray-request prevention. The placeholder proxy host ends in .invalid, and the example IPv4s are documentation values.
The nine tests cover each expected address, an unexpected address, invalid response shapes, a non-2xx response, missing and duplicate pair configuration, and a missing proxy setting. They check that the echo receives no provider Authorization header. Run them inside the application’s normal isolated test environment:
php artisan test --filter=QuotaGuardEgressProbeTest
Fakes test application decisions, not a CONNECT exchange, proxy authentication, TLS, network timeouts, or failover. Keep separate deployed acceptance checks for those behaviors. Review custom service providers that globally change HTTP options or headers before adopting the example.
Preserve the real integration contract
A generic echo example should not invent a partner’s API path or authentication pattern. When wiring the application, retain the provider’s exact supported endpoint, authorization, headers, data schema, idempotency behavior, and response handling. Use the selected client as the transport change, then separately prove that the provider request remains valid.
Download the reference examples · Integration overview