setono / gls-webservice-bundle
Symfony 扩展包,集成了 GLS webservice PHP SDK
v1.3.0
2022-10-11 09:54 UTC
Requires
- php: >=7.4
- ext-soap: *
- setono/gls-webservice-php-sdk: ^2.0
- symfony/config: ^5.4 || ^6.0
- symfony/dependency-injection: ^5.4 || ^6.0
- symfony/http-kernel: ^5.4 || ^6.0
Requires (Dev)
- matthiasnoback/symfony-config-test: ^4.3
- matthiasnoback/symfony-dependency-injection-test: ^4.3
- nyholm/symfony-bundle-test: ^2.0
- phpunit/phpunit: ^9.5
- psalm/plugin-phpunit: ^0.17
- psalm/plugin-symfony: ^3.1
- roave/security-advisories: dev-latest
- setono/code-quality-pack: ^2.2
This package is auto-updated.
Last update: 2024-08-29 04:49:05 UTC
README
将 GLS webservice PHP SDK 集成到 Symfony。
安装
步骤 1: 下载扩展包
打开命令行,进入您的项目目录并执行以下命令以下载此插件的最新稳定版本
$ composer require setono/gls-webservice-bundle
此命令要求您全局安装了 Composer,如 Composer 文档中的安装章节所述。
步骤 2: 启用扩展包
通过将其添加到 config/bundles.php
中注册的插件/扩展包列表中来启用插件
<?php $bundles = [ // ... Setono\GlsWebserviceBundle\SetonoGlsWebserviceBundle::class => ['all' => true], // ... ];
使用方法
现在您可以注入 ClientInterface
到您的服务中
<?php use Setono\GLS\Webservice\Client\ClientInterface; final class YourService { private $client; public function __construct(ClientInterface $client) { $this->client = $client; } }
使用自动绑定,这将直接生效。如果您没有使用自动绑定,您必须在服务定义中注入它
<?xml version="1.0" encoding="UTF-8" ?> <container xmlns="https://symfony.com.cn/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://symfony.com.cn/schema/dic/services https://symfony.com.cn/schema/dic/services/services-1.0.xsd"> <services> <service id="YourService"> <argument type="service" id="Setono\GLS\Webservice\Client\ClientInterface"/> </service> </services> </container>