Laravel Cloud example code and offline checks

Download the Laravel Cloud examples ZIP. Extract the archive before following the commands below.

These files are standalone reference snippets to add to your Laravel application. They assume a Laravel application using its standard Guzzle cURL transport. No credentials are included. No PHP, Composer, Laravel, Cloud, proxy, or destination API execution has been performed.

  1. Add config/quotaguard.php and app/Support/QuotaGuardHttp.php to the application.
  2. Merge routes/console-snippet.php into routes/console.php, retaining existing commands and avoiding duplicate imports and PHP opening tags.
  3. Configure the real QUOTAGUARDSTATIC_URL only through the target environment’s secret or environment-variable workflow. Do not commit it.
  4. Deploy after changes. If caching config, Laravel Cloud says to run php artisan optimize or config:cache during build, not deploy commands.
  5. Run php artisan quotaguard:check through Cloud’s non-interactive Commands tab and compare the returned IP with the two assigned IPv4 addresses. A 200 alone is not a match assertion.
  6. Use the same factory for only the API requests that need the allowlist, preserving the provider’s authentication and request semantics. Independently configured SDKs, raw cURL, browsers, database drivers, unrelated Http calls, and other processes are not automatically configured.

The CURLOPT_NOPROXY empty string disables libcurl’s host bypass list for this client, not globally. The sample stops before making a request if its proxy URL is missing. It has no direct-request fallback and does not disable TLS certificate verification. It disables automatic redirects, so a 3xx requires explicit review.

The IP-check command intentionally sends no partner API credentials. It reads the JSON ip field, validates it as an IPv4 address with FILTER_VALIDATE_IP and FILTER_FLAG_IPV4, and prints only that validated address. A missing, non-string, or invalid value fails with a fixed message and a nonzero exit code. It never prints the raw response body and catches failures without dumping raw transport exception text. Inspect diagnostics privately when debugging. The address still needs to be manually matched against the two allocated IPv4 addresses.

Before calling this a tested integration, run PHP lint and application tests, then verify deployed web, real queue-worker, and scheduled-job request paths as applicable. A Cloud Commands invocation runs on any available environment instance and does not prove that each application path uses this client.


Ready to Get Started?

Get in touch or create a free trial account

Back to top ↑

Copyright © 2009 - 2026 QuotaGuard. All rights reserved.