- How do I install Cuzzle in a Laravel application?
- Install it with Composer using composer require octoper/cuzzle. Laravel's package auto-discovery should register the service provider and facade; if your app disables discovery, add them manually. Check the README for any optional config publishing step before you rely on custom defaults.
- Which Laravel and PHP versions does Cuzzle support?
- Cuzzle is built for Laravel and depends on Guzzle, so your PHP version must satisfy Guzzle's requirements. Check the package's composer.json for the exact Laravel, PHP, and Guzzle constraints before installing. If you run an older Laravel LTS, verify compatibility in the README or test matrix first.
- How do I make a GET request with Cuzzle?
- Call the Cuzzle facade with the request method and URL, for example Cuzzle::get('https://api.example.com/users'). The returned response is PSR-7 compliant, so you can inspect the status code, headers, and body. Confirm the exact method signature in the README because facade helpers can vary by version.
- Does Cuzzle support POST, PUT, DELETE, and custom request options?
- Yes. Cuzzle supports the common HTTP verbs including GET, POST, PUT, and DELETE, plus custom Guzzle request options. That lets you send JSON payloads, set headers, and tune per-request behavior without dropping down to raw Guzzle.
- What Guzzle version does Cuzzle require?
- Cuzzle wraps Guzzle, so the allowed Guzzle version is defined by its Composer constraints. Check composer.json for the exact Guzzle major version and confirm it matches the version already used in your application. Avoid forcing incompatible Guzzle majors in the same dependency graph.
- How do I configure default headers, timeouts, or a base URL in Cuzzle?
- Cuzzle supports configurable defaults for timeouts, headers, and base URLs. In Laravel, publish the package config if it provides one and set the defaults there; otherwise pass options on each request. Keep environment-specific values in .env and avoid committing secrets to config files.
- Does Cuzzle return PSR-7 responses?
- Yes. Cuzzle returns PSR-7 compliant responses from Guzzle, so you can use standard methods to read the status, headers, and body. This makes it easy to integrate with code that already expects PSR-7 messages.
- How should I test Laravel code that uses Cuzzle?
- Because Cuzzle sits on Guzzle, you can inject a Guzzle MockHandler or bind a fake client in Laravel's container. Assert on the PSR-7 status, headers, and body instead of making real network calls. Keep a small number of sandbox integration tests for end-to-end confidence.
- Is Cuzzle actively maintained and safe to use in production?
- A recent 3.1.0 release indicates activity, but you should still check release frequency and issue response times on GitHub before relying on it for critical paths. Pin a known version in composer.json and review the changelog before upgrading. In production, avoid logging sensitive request headers or payloads and keep a fallback to Guzzle or Laravel's HTTP client.
- How does Cuzzle compare to Laravel's HTTP client or using Guzzle directly?
- Cuzzle offers a cURL-style facade over Guzzle, which can be quicker for simple API calls and developers who like that style. Laravel's HTTP client provides first-party integration, testing helpers, and retry support, while raw Guzzle gives maximum control. Choose Cuzzle if its API fits your team; otherwise use Laravel HTTP or Guzzle directly.