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

Nusoap Bundle Laravel Package

noiselabs/nusoap-bundle

Integrates the NuSOAP PHP toolkit with Symfony, providing a convenient way to build and consume SOAP web services inside Symfony applications. The bundle wires NuSOAP into the framework so SOAP endpoints and clients can be defined and configured with minimal boilerplate.

View on GitHub
Deep Wiki
Context7

Getting Started

This package is a Symfony2 bundle, not a Laravel package. It is a thin integration layer that registers NuSOAP classes/services inside a Symfony2 container. For a Laravel codebase, do not install noiselabs/nusoap-bundle; use the underlying NuSOAP library directly and copy the bundle’s service-wiring ideas into a Laravel service provider.

Minimal path:

  1. Confirm the SOAP endpoint and WSDL URL you need to consume.
  2. In Laravel, install or vendor NuSOAP directly, e.g. composer require nusoap/nusoap. If the library is not PSR-4 autoloadable, place it under app/Support/NuSOAP and add a classmap entry in composer.json.
  3. Create a small wrapper service in app/Services rather than calling new \nusoap_client(...) from controllers.
  4. Bind the wrapper as a singleton in AppServiceProvider or use Laravel’s container auto-resolution.
  5. Exercise it first from php artisan tinker or a throwaway Artisan command before wiring it into HTTP flows.

Where to look first in the repository:

  • README.md for the intended Symfony registration/configuration.
  • DependencyInjection/ for the extension class and configuration tree.
  • Resources/config/services.* for the service definition the bundle exposes.
  • The bundle class itself to see what is registered in the kernel.

First realistic use case: consuming a legacy SOAP/WSDL service from a Laravel controller or queued job. A minimal wrapper looks like:

namespace App\Services;

class LegacySoapClient
{
    protected \nusoap_client $client;

    public function __construct(array $config)
    {
        $this->client = new \nusoap_client($config['wsdl'], true);
        $this->client->setCredentials($config['username'], $config['password']);
        $this->client->timeout = $config['timeout'] ?? 30;
        $this->client->response_timeout = $config['response_timeout'] ?? 30;
        $this->client->soap_defencoding = 'UTF-8';

        if ($error = $this->client->getError()) {
            throw new \RuntimeException('NuSOAP init failed: '.$error);
        }
    }

    public function call(string $operation, array $params = [])
    {
        $result = $this->client->call($operation, $params);

        if ($this->client->fault) {
            throw new \RuntimeException('SOAP fault: '.json_encode($result));
        }

        if ($error = $this->client->getError()) {
            throw new \RuntimeException('SOAP error: '.$error);
        }

        return $result;
    }
}

Implementation Patterns

Wrap NuSOAP behind an application service. The bundle’s main value is container integration; in Laravel, your wrapper is the integration point. Inject LegacySoapClient into controllers, actions, and jobs instead of instantiating NuSOAP everywhere.

Centralize configuration. Keep WSDL URL, credentials, timeouts, and encoding in config/services.php or a dedicated config/legacy-soap.php, sourced from .env. Avoid scattering endpoint strings across the codebase.

Support multiple named clients. If you integrate more than one legacy SOAP service, build a small factory:

class SoapClientFactory
{
    public function __construct(private array $configs) {}

    public function client(string $name): LegacySoapClient
    {
        return new LegacySoapClient($this->configs[$name]);
    }
}

Bind the factory as a singleton and resolve clients by name.

Use queued jobs for unreliable endpoints. SOAP services are often slow or flaky. Put calls in jobs with explicit $tries, $backoff, and retry_after values. This gives you retries and isolation from request timeouts.

Normalize errors at the boundary. NuSOAP generally returns errors rather than throwing. Convert fault, getError(), and malformed responses into domain exceptions so controllers and jobs do not branch on NuSOAP internals.

Log request/response around the call. NuSOAP exposes request, response, and debug_str properties. Log them at debug level in non-production and redact credentials or sensitive payload fields.

Use WSDL mode unless you must not. Pass true as the second constructor argument when you have a WSDL. For non-WSDL mode, you must supply the endpoint, namespace, SOAP action, and often explicit complex-type definitions — more brittle and more code.

Testing pattern. Define a SoapClientInterface with a call() method, bind the real wrapper in production, and bind a fake in tests. Do not hit live SOAP endpoints in feature tests. Use captured XML fixtures if you need to test response parsing.

Symfony-side pattern, if relevant. In a Symfony2 app, the bundle is registered in AppKernel, configured under its extension alias, and the exposed service is injected into controllers/services. Custom behavior is usually added by overriding the service definition or decorating the bundle service.

Gotchas and Tips

  • Do not install this bundle in Laravel. Its Symfony2 constraints will conflict with modern Laravel’s Symfony components. Treat the bundle as documentation for how to wire NuSOAP, and use NuSOAP directly.
  • NuSOAP is effectively legacy software. Verify PHP compatibility before committing. Older NuSOAP releases have issues on PHP 8+, including dynamic-property deprecations and removed legacy PHP constructs. Test on your exact PHP version.
  • Errors are not exceptions. Check getError() after construction and after every call. Check $client->fault separately for SOAP faults. A successful transport with an empty result can still be a business error.
  • Debugging is built in but noisy. Set $client->debug = true and inspect debug_str, request, and response. Disable debug in production and sanitize credentials before logging.
  • Set timeouts explicitly. NuSOAP defaults are not aligned with Laravel request/queue timeouts. Set both timeout and response_timeout, and ensure queue retry_after is longer than the worst-case SOAP call.
  • Large WSDLs are expensive. NuSOAP parses the WSDL on client construction. Avoid constructing a client per loop iteration; reuse a client within a request/job where safe, or cache generated proxy classes if your workflow allows it.
  • Encoding pitfalls are common. Set soap_defencoding = 'UTF-8' and verify whether the remote service expects ISO-8859-1. Double-encoded entities and mismatched encodings produce hard-to-read faults.
  • TLS and modern ciphers can fail. NuSOAP’s transport is old. If the endpoint requires modern TLS, test early; native SoapClient, phpro/soap-client, or laminas/laminas-soap may be safer than patching NuSOAP.
  • Low adoption means low support. With 21 stars and zero dependents, expect no community fixes. Pin the NuSOAP version, isolate it behind your own interface, and keep an exit path to native SoapClient or a maintained SOAP client.
  • Extension point in Laravel is your wrapper. The bundle’s Symfony extension points — service overrides, compiler passes, configuration — have no direct Laravel equivalent. Your service provider binding, factory, and interface are the extension points that matter.
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.
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route