Integrates the GLS webservice PHP SDK into Symfony.
composer require setono/gls-webservice-bundleThe bundle will automatically be enabled with Symfony Flex. Otherwise add it to config/bundles.php yourself.
Now you can inject the ClientInterface into your service:
<?php
use Setono\GLS\Webservice\Client\ClientInterface;
final class YourService
{
public function __construct(private readonly ClientInterface $client)
{
}
}With autowiring this will work out of the box. If you're not using autowiring you have to inject it in your service definition:
<?php
use Setono\GLS\Webservice\Client\ClientInterface;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
return static function (ContainerConfigurator $container): void {
$container->services()
->set(YourService::class)
->args([service(ClientInterface::class)]);
};