in2code / in2connector
企业级连接管理器,适用于LDAP、SOAP等。
2.1.0
2017-12-08 14:45 UTC
Requires
- vertexvaar/logs: 1.2.*
README
in2connector 是一个TYPO3扩展,用于简化您使用各种连接的日常生活。此扩展提供两种类型的驱动程序,以方便访问资源。这些是LDAP和SOAP。这些驱动程序围绕您对A/D / LDAP / SAP和其他API提供者的连接进行包装。
要开始使用 in2connector,您只需要一个带有标识符和连接类型的连接。
ext_localconf.php
$connectionRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\In2code\In2connector\Registry\ConnectionRegistry::class
);
$connectionRegistry->demandConnection('myExtension|connectionPurpose', TX_IN2CONNECTOR_DRIVER_LDAP);
提示:您可以使用任何字符串作为连接标识符。
转到您的后端,进入 in2connector 模块,点击“添加连接”以配置您的连接。保存您的更改并关闭设置表单以返回到连接概述。现在您将看到一个表示您的连接状态的图标,如果它有误,它还会显示错误消息。
现在您可以使用连接的驱动程序来搜索、修改、添加和删除条目。
PersonRepository.php
use In2code\In2connector\Driver\LdapDriver;
use In2code\In2connector\Service\ConnectionService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class PersonRepository
{
/**
* @var LdapDriver
*/
protected $driver = null;
/**
* PersonRepository constructor.
*/
public function __construct()
{
$this->driver = GeneralUtility::makeInstance(ConnectionService::class)->getDriverInstanceIfAvailable('asd');
}
public function findAll()
{
return $this->driver->searchAndGetResults('', 'objectClass=*');
}
}
您当然可以注册自己的驱动程序(例如带有JSON或XML的Rest-API)。查看已发货驱动程序的注册以获取灵感。