Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Release: ServiceM8 Webform Integration 1.2.1 — Minor update available for module servicem8_webform (1.2.1). Release: PostfixAdmin 1.0.0 — Initial release available for module postfix_admin (1.0.0)! Release: ip_analyser 1.0.3 — Minor update available for module ip_analyser (1.0.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

About this module

This module provides a configuration entity, Integration, and a connection service, ConnectionClient, which, when combined, will allow a developer to set up integrations and connect to them with ease.

When used correctly, this module will save you from having to add connection details in your code, and will put control of integrations into site administrators' hands. It reduces the amount of hardcoding required and allows the config integrations to be stored as exportable config.

There is an interface which allows administrators to view and edit the integrations. On its own, this module does nothing except to provide a framework for connecting to other sites.

This module is mostly useful for REST connections. If you need to extend this for use with SOAP connections, the Meng AsyncSoap library works really well: https://packagist.org/packages/meng-tian/async-soap-guzzle

Integration entities

There is no way to add an Integration entity through the user interface.

If you want to create an Integration entity, you must add it in the config/install/ directory of your custom module. These values are editable through the user interface, under the Configuration > Integrations menu link.

An Integration must include an external end point and an authentication type. If no authentication is required, then you can set it to 'none'.

If an Integration is not set to 'Active', no requests should be made. There is some rudimentary prevention in place for this.

If an Integration is in 'debug mode', you can trigger logging. This is useful for recording which requests are made with which parameters etc. It's up to the developer to make sure that debug logging happens - it's just a useful flag.

Connection client

The Connection client extends Drupal's core httpClient service, providing some default functions to configure any requests you may make.

In order to create a Connection, you must provide a valid Integration. The Integration is the source of any configuration for a Connection, so you won't be able to create a Connection unless you've got an Integration to feed it. (If you don't need to provide details from an Integration, just use Drupal's core httpClient service.)

There are two ways to create a Connection. You can create it on a page using a controller, by extending the ConnectionController class. You will have a fully-fledged Connection client that is linked to the Integration you provide.

Alternatively, you can instantiate it directly:

$client = new ConnectionClient();
$client->setIntegration($integration);
$client->configure();

$request = $client->get($client->getRequestEndPoint(), $client->getRequestConfig());

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Apr 2023
Latest release
3 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core Release date
2.1.0 Stable Apr 20, 2023