Install via Composer:
composer require vendor/package-name
The package now enforces the use of the new SOAP client (introduced in v3.4.5). Ensure your config/package.php (or equivalent) is updated to reflect this change. The minimal setup remains:
use Vendor\Package\Facades\SoapClient;
$client = SoapClient::create(['wsdl' => 'your_wsdl_url']);
$response = $client->call('methodName', ['args']);
First use case: Replace legacy SoapClient calls with the package’s wrapper to leverage the new client under the hood. Check the migration guide for legacy client deprecation steps.
The package now mandates the use of the new SOAP client (likely ext-soap v8+ or a custom wrapper). Update your service layer to:
SoapClient:
public function __construct(private SoapClient $soapClient) {}
$client = SoapClient::withWsdlCache()->create(['wsdl' => 'url']);
use Vendor\Package\Traits\SoapClientExtensions;
class CustomClient extends SoapClient {
use SoapClientExtensions;
}
call() method with typed arguments for better validation:
$response = $soapClient->call('GetUser', ['id' => 123], UserResponse::class);
Vendor\Package\Exceptions\SoapException with structured data. Catch and log:
try {
$soapClient->call('FaultyMethod');
} catch (SoapException $e) {
logger()->error('SOAP Error', ['code' => $e->getCode(), 'details' => $e->getDetails()]);
}
SoapClient Deprecation: Direct use of PHP’s native SoapClient will fail if the package’s client is forced globally. Update DI bindings:
// Old (deprecated)
$client = new \SoapClient('wsdl');
// New
$client = SoapClient::create(['wsdl' => 'wsdl']);
config/services.php doesn’t conflict:
'soap' => [
'client' => Vendor\Package\SoapClient::class, // Force new client
],
$client = SoapClient::debug()->create(['wsdl' => 'url']);
SchemaValidationException, check your WSDL for:
targetNamespace.$client = SoapClient::decorate(function ($client) {
$client->setHeaders(['Authorization' => 'Bearer token']);
return $client;
})->create(['wsdl' => 'url']);
SoapClient::middleware([
new \Vendor\Package\Middleware\LoggingMiddleware(),
]);
How can I help you explore Laravel packages today?