Weave Code
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 Process Bundle Laravel Package

cleverage/soap-process-bundle

View on GitHub
Deep Wiki
Context7
## Getting Started
This package (`cleverage/soap-process-bundle`) simplifies SOAP service integration in Laravel/Symfony applications. For **v3.0**, ensure your environment meets the new **PHP 8.5** and **Symfony 8** requirements before installation.

1. **Installation**:
   ```bash
   composer require cleverage/soap-process-bundle

For Laravel, publish the config:

php artisan vendor:publish --provider="Cleverage\SoapProcessBundle\SoapProcessBundle"
  1. First Use Case: Define a SOAP client in config/soap_process.php:
    'clients' => [
        'example' => [
            'wsdl' => 'https://example.com/soap?wsdl',
            'options' => [
                'trace' => true,
                'exceptions' => true,
            ],
        ],
    ],
    
    Inject the client into a service and call SOAP methods:
    use Cleverage\SoapProcessBundle\Client\ClientInterface;
    
    public function __construct(private ClientInterface $soapClient) {}
    
    public function callSoapService() {
        $result = $this->soapClient->call('example', 'MethodName', ['arg1' => 'value']);
        return $result;
    }
    

Implementation Patterns

1. Dependency Injection

Leverage Laravel/Symfony’s DI container to inject ClientInterface into services:

// Laravel (Service Provider)
$this->app->bind(ClientInterface::class, function ($app) {
    return $app->make('cleverage.soap_process.client');
});

2. Configuration Management

Centralize SOAP endpoints in config/soap_process.php for maintainability:

'clients' => [
    'inventory' => [
        'wsdl' => env('SOAP_INVENTORY_WSDL'),
        'options' => [
            'login' => env('SOAP_USERNAME'),
            'password' => env('SOAP_PASSWORD'),
        ],
    ],
],

3. Error Handling

Use try-catch with SoapFault for robust error handling:

try {
    $response = $this->soapClient->call('example', 'GetData');
} catch (SoapFault $fault) {
    Log::error("SOAP Error: {$fault->getMessage()}");
    throw new \RuntimeException('SOAP service unavailable');
}

4. Testing

Mock SOAP responses in tests using Laravel’s HTTP testing or PHPUnit:

// Example: Mocking a SOAP response
$mockHandler = $this->getMockBuilder(SoapClient::class)
    ->disableOriginalConstructor()
    ->onlyMethods(['__doRequest'])
    ->getMock();

$mockHandler->method('__doRequest')->willReturn('<soap:Envelope>...</soap:Envelope>');
$this->soapClient->setClient($mockHandler);

Gotchas and Tips

Breaking Changes (v3.0)

  • Dropped Support: PHP 8.1 and Symfony 7.3 are no longer supported. Update your environment or pin to v2.x if needed.
    • Fix: Run composer require php:^8.5 and update Symfony to ^8.0.

Configuration Quirks

  • WSDL Caching: The bundle caches WSDL definitions. Clear cache after WSDL updates:
    php artisan cache:clear
    
  • SSL Issues: If SOAP endpoints use self-signed certificates, add to options:
    'options' => [
        'local_cert' => 'path/to/cert.pem',
        'passphrase' => 'cert_password',
    ],
    

Debugging Tips

  1. Enable Trace: Add 'trace' => true to client options to log raw SOAP requests/responses in Laravel logs.
  2. Validate XML: Use DOMDocument to validate SOAP responses:
    $dom = new DOMDocument();
    $dom->loadXML($response);
    if ($dom->schemaValidate('schema.xsd')) { ... }
    
  3. Environment-Specific Config: Use Laravel’s config('soap_process.clients.example.wsdl') with environment variables:
    'wsdl' => env('SOAP_EXAMPLE_WSDL', 'default.wsdl'),
    

Extension Points

  • Custom Clients: Extend Cleverage\SoapProcessBundle\Client\Client to add pre/post-processing logic.
  • Middleware: Intercept SOAP calls via Laravel middleware or Symfony event listeners.
  • Logging: Override the default logger by binding a custom Psr\Log\LoggerInterface to cleverage.soap_process.logger.

NO_UPDATE_NEEDED would **not** apply here due to the breaking changes and new features.
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.
anousss007/vigilance
supportpal/eloquent-model
ardenexal/fhir-models
laravel-at/laravel-image-sanitize
romalytar/yammi-audit-log-laravel
ardenexal/fhir-validation
arshaviras/weather-widget
laravel-chronicle/core
sunchayn/nimbus
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon