- What is payment/httpclient used for in Laravel payment integrations?
- payment/httpclient is intended for sending API requests to payment gateways and keeping checkout and billing code clean and testable. The repository describes it as an HTTP client interface based on the FIG proposed standard, so it is most useful as an abstraction around gateway HTTP calls. In Laravel, you would type-hint the interface and bind a concrete client implementation.
- How do I install payment/httpclient with Composer?
- Install it with composer require payment/httpclient. Because the package lives under payment-legacy and the provided metadata has no release details, check Packagist and composer.json for the correct version constraint. Commit the composer.lock change and run your test suite after installation.
- Which Laravel and PHP versions does payment/httpclient support?
- The provided context does not list Laravel or PHP version constraints. Treat it as a framework-agnostic PHP package and verify composer.json for PHP requirements before installing in Laravel 8, 9, 10, 11, or newer. Laravel compatibility mainly depends on the PHP version and any PSR dependencies.
- Is payment/httpclient an actual HTTP client or only an interface?
- The overview describes payment/httpclient as an HTTP client interface, meaning it defines contracts rather than the transport that actually sends requests. You need a concrete implementation or adapter to make real gateway calls. The blurb calls it a lightweight client, but the repository description is the more precise source. Confirm the available interfaces in the source code.
- Does payment/httpclient follow PSR-18 or the FIG HTTP client standard?
- It references the FIG proposed HTTP client interface, which predates the finalized PSR-18 client interface. PSR-18 is the modern standard for HTTP client interoperability, while Guzzle is a concrete client implementation. If you need PSR-18 compatibility, check whether payment/httpclient provides an adapter or use a separate PSR-18 client in your integration layer.
- How do I configure payment/httpclient for a payment gateway?
- The provided context does not document configuration options, so configuration is likely implementation-specific. A common Laravel pattern is to bind the payment/httpclient interface to your chosen concrete client in a service provider. Keep gateway credentials in config/services.php and environment variables, not in client code.
- How do I test Laravel code that depends on payment/httpclient?
- Type-hint the payment/httpclient interface in your checkout or billing classes and bind a fake implementation in Laravel's service container during tests. The fake can return canned success, decline, and error responses so you can assert your application behavior without calling a real gateway. The provided context does not document a built-in fake, so you may need to write a small test double.
- Can I use payment/httpclient outside of Laravel?
- Yes. It is a PHP package with a Laravel-friendly blurb, not a Laravel-only component. You can use it in any PHP application that can install its Composer dependencies. Laravel users get the extra benefit of container binding and easier mocking.
- What production concerns should I check before using payment/httpclient?
- The interface alone does not guarantee timeouts, retries, TLS verification, or connection pooling; your concrete client implementation must handle those. For payment flows, also plan idempotency keys, structured logging, and clear error mapping for declines and transport failures. Review the implementation you bind before using it in production.
- Is payment/httpclient maintained, and what are the alternatives?
- The repository is under the payment-legacy organization and the provided README and TPM assessment are empty, so check GitHub commits, Packagist releases, and issue activity before adopting it. For new projects, compare with PSR-18 clients, Guzzle, and Laravel's built-in HTTP client. If you need a maintained payment abstraction, prefer a package with recent releases and documentation.