Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Soap Client

Soap Client Laravel Package

phpro/soap-client

A general-purpose SOAP client for PHP with WSDL-based code generation, type-safe wrappers, PSR-18 transport, middleware, and extensible event-driven customization for clean, maintainable integrations.

View on GitHub
Deep Wiki
Context7

A general purpose SOAP client for PHP

Frequently asked questions about Soap Client
What is phpro/soap-client used for in a Laravel application?
It generates a type-safe, object-oriented SOAP client from a WSDL so you can call legacy SOAP services with typed request and response objects instead of raw XML or SoapClient arrays. In Laravel it is typically used behind a gateway or repository interface for integrations such as payment, ERP, or government APIs. The package handles encoding, decoding, and SOAP faults while leaving HTTP transport to a PSR-18 client. It is framework-agnostic, so Laravel integration is glue code you own.
How do I install and configure phpro/soap-client in Laravel?
Install it with Composer alongside a PSR-18 HTTP client such as Guzzle 7, then define a ClientSpecification for your WSDL and run the generator to produce the client and value objects. Register the generated client in a Laravel service provider, binding it to your own interface and injecting configuration from config/services.php or a dedicated config file. Most setup effort goes into the WSDL contract and authentication, not the library itself. Expect roughly a one-to-two-day spike for a well-formed WSDL.
Does phpro/soap-client support Laravel 10 or 11 and is there a service provider?
The package requires PHP 8.x and is framework-agnostic, so it works with any Laravel version that runs a supported PHP version. There is no first-party Laravel service provider, config schema, or facade, so you write and maintain the container binding and configuration glue yourself. That glue layer is a real recurring cost, but it also lets you shape the integration around your domain interfaces. Keep the generated client behind your own gateway so domain code never depends on generated classes.
How does WSDL-based code generation work and when should I regenerate?
You point the generator at a WSDL/XSD through a ClientSpecification, and it emits a typed client plus request and response classes that map to the contract. Regenerate whenever the provider publishes a WSDL revision, and treat generated code as build output: either commit it and diff it in CI or build it at deploy time, but be consistent. Large enterprise WSDLs can emit hundreds of classes, so decide who reviews or explicitly excludes them. Because third-party WSDLs can change without notice, pin or vendor the WSDL and watch for silent runtime mismatches.
Can I use Guzzle or Laravel's HTTP client with phpro/soap-client?
Yes. The package supports PSR-18 HTTP clients, and Guzzle 7 satisfies PSR-18 directly, so it is the usual choice for transport. You can also plug in PSR-17 request factories, a PSR-3 logger, and PSR-16 cache through middleware. Laravel's own HTTP client is not PSR-18, so wrapping it is not the straightforward path. Use a PSR-18 adapter or Guzzle and keep transport concerns in middleware rather than call sites.
How does phpro/soap-client handle SOAP faults and errors?
SOAP faults are surfaced as typed exceptions, so you can catch and handle them like ordinary PHP errors instead of parsing XML responses. The middleware pipeline is the right place to add logging, last-request capture, and validation so failures are diagnosable in production. Pair this with Laravel's exception handler and logging channels, and consider queue retries for transient transport failures. Always keep the original request and response available for support cases.
Does phpro/soap-client support WS-Security, WS-Addressing, or MTOM attachments?
WS-* extensions are only partially supported. UsernameToken, X.509 signing and encryption, WS-Addressing, MTOM attachments, and SOAP 1.2 quirks each require custom middleware or manual envelope work. Where a provider mandates WS-Security or MTOM, you either build that middleware or fall back to the ext-soap-backed engine, which forfeits much of the PSR-18 and type-safety benefit. Decide this before committing to the package.
How do I test SOAP integrations built with phpro/soap-client in Laravel?
Generated request and response objects are plain PHP value objects, so you can unit-test mapping, validation, and domain logic without making network calls. Isolate the generated client behind an interface and swap in a fake or a test transport in Laravel's container for feature tests. Middleware such as last-request capture helps assert the outgoing envelope. For migrations, keep golden-request fixtures so you can prove parity with ext-soap or NuSOAP.
Is phpro/soap-client production-ready and actively maintained?
It is a mature, actively maintained package with roughly 890 GitHub stars and a single-vendor maintenance model, which is thinner than Guzzle or Laravel but still shows recent releases. Expect to be your own first-line support for edge-case SOAP behaviour and unusual provider quirks. Pin versions, keep WSDLs vendored, and add integration tests around the generated client. The biggest production risks are schema drift and WS-* gaps rather than the library's core encoding and decoding.
How do I migrate from ext-soap or NuSOAP, and what are the alternatives?
Use a strangler-fig approach: inventory every SOAP endpoint, pick the highest-value, lowest-complexity WSDL for a pilot, generate the client, wrap it in a domain interface, and cut over with golden-request fixtures proving parity. Alternatives include PHP's native ext-soap SoapClient, NuSOAP, and other WSDL-to-PHP generators; ext-soap is the safer choice when you need full WS-Security or MTOM. phpro/soap-client is strongest when you want typed, statically analyzable clients over PSR-18 transport. Weigh the provider's required WS-* features before choosing.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo