setono / dao-bundle
Symfony 扩展包,集成了 DAO PHP SDK
v1.2.0
2023-10-10 07:16 UTC
Requires
- php: >=7.4
- setono/dao-php-sdk: ^2.0
- symfony/config: ^5.4 || ^6.0
- symfony/dependency-injection: ^5.4 || ^6.0
- symfony/framework-bundle: ^5.4 || ^6.0
Requires (Dev)
- ergebnis/composer-normalize: ^2.0
- kriswallsmith/buzz: ^1.0
- matthiasnoback/symfony-config-test: ^4.0
- matthiasnoback/symfony-dependency-injection-test: ^4.0
- nyholm/psr7: ^1.1
- phpstan/phpstan: ^0.11.0
- phpstan/phpstan-strict-rules: ^0.11.1
- phpunit/phpunit: ^8.0
- symplify/easy-coding-standard: ^5.1
This package is auto-updated.
Last update: 2024-09-15 07:01:52 UTC
README
将 DAO PHP SDK 集成到 Symfony。
安装
步骤 1: 下载扩展包
打开命令行,进入项目目录并执行以下命令以下载此插件的最新稳定版本
$ composer require setono/dao-bundle
此命令要求您已全局安装 Composer,如 Composer 文档的 安装章节 中所述。
步骤 2: 启用扩展包
通过将其添加到 config/bundles.php
中的已注册插件/扩展包列表中来启用插件
<?php $bundles = [ // ... Setono\DAOBundle\SetonoDAOBundle::class => ['all' => true], // ... ];
使用方法
现在您可以将 ClientInterface
注入到您的服务中
<?php use Setono\DAO\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\DAO\Client\ClientInterface"/> </service> </services> </container>