setono / post-nord-bundle
Symfony bundle that integrates the PostNord PHP SDK
Fund package maintenance!
Setono
Installs: 22 467
Dependents: 3
Suggesters: 3
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=8.1
- setono/post-nord-php-sdk: ^2.0@alpha
- symfony/config: ^5.4 || ^6.4 || ^7.0
- symfony/dependency-injection: ^5.4 || ^6.4 || ^7.0
- symfony/http-kernel: ^5.4 || ^6.4 || ^7.0
Requires (Dev)
- infection/infection: ^0.27.11
- matthiasnoback/symfony-config-test: ^4.3 || ^5.1
- matthiasnoback/symfony-dependency-injection-test: ^4.3 || ^5.1
- nyholm/psr7: ^1.1
- phpunit/phpunit: ^9.6
- psalm/plugin-phpunit: ^0.19.0
- setono/code-quality-pack: ^2.7.2
- symfony/http-client: ^5.4 || ^6.4 || ^7.0
This package is auto-updated.
Last update: 2024-11-10 10:47:52 UTC
README
Integrates the PostNord PHP SDK into Symfony.
Installation
Step 1: Download the bundle
composer require setono/post-nord-bundle
Step 2: Enable the bundle
Enable the plugin by adding it to the list of registered plugins/bundles in config/bundles.php
:
<?php $bundles = [ // ... Setono\PostNordBundle\SetonoPostNordBundle::class => ['all' => true], // ... ];
Usage
Now you can inject the ClientInterface
into your service:
<?php use Setono\PostNord\Client\ClientInterface; final class YourService { private $client; public function __construct(ClientInterface $client) { $this->client = $client; } }
With auto wiring this will work out of the box. If you're not using auto wiring you have to inject it in your service definition:
<?xml version="1.0" encoding="UTF-8" ?> <container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> <services> <service id="YourService"> <argument type="service" id="Setono\PostNord\Client\ClientInterface"/> </service> </services> </container>