> For the complete documentation index, see [llms.txt](https://docs.xibosignage.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xibosignage.com/developer/widgets/connectors.md).

# Connectors

Connectors allow developers to easily hook into the various events raised by Xibo’s event system. In `v4` they will also be able to provide data for widgets. They are shown on the “Applications” page, and allow a user to enable/disable as well as provide settings such as API keys.

All custom connectors need a definition file to tell Xibo where the class file is located. These definition files are simple and should be placed in the `/custom` folder with a `.connector` extension. The file below is an example called `/custom/my-connector.connector`. The file name will be used as the ID of the file and should be unique to your connector.

{% code title="/custom/my-connector.connector" %}

```json
{
    "className": "\\Xibo\\Custom\\MyConnector"
}
```

{% endcode %}

Connectors then need the named class to implement the `\Xibo\Connector\ConnectorInterface`. A trait is provided for common functions.

Below is an example connector class file which registers a listener for the `maintenance.regular.event` and outputs a simple log line when that event occurs.

{% code title="MyConnector.php" %}

```php
<?php

namespace Xibo\Custom;

use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Xibo\Connector\ConnectorInterface;
use Xibo\Connector\ConnectorTrait;
use Xibo\Event\MaintenanceRegularEvent;
use Xibo\Support\Sanitizer\SanitizerInterface;

class MyConnector implements ConnectorInterface
{
    use ConnectorTrait;

    public function registerWithDispatcher(EventDispatcherInterface $dispatcher): ConnectorInterface
    {
        $dispatcher->addListener('maintenance.regular.event', [$this, 'onRegularMaintenance']);
        return $this;
    }

    public function getSourceName(): string
    {
        return 'my-connector';
    }

    public function getTitle(): string
    {
        return 'My Connector';
    }

    public function getDescription(): string
    {
        return 'This is my connector';
    }

    public function getThumbnail(): string
    {
        return '';
    }

    public function getSettingsFormTwig(): string
    {
        return '';
    }

    public function processSettingsForm(SanitizerInterface $params, array $settings): array
    {
        return $settings;
    }

    public function onRegularMaintenance(MaintenanceRegularEvent $event)
    {
        $this->getLogger()->debug('onRegularMaintenance: My connector!');
    }
}
```

{% endcode %}

Related link: <https://account.xibosignage.com/docs/developer/extend/connectors#content-connectors>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.xibosignage.com/developer/widgets/connectors.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
