> 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/upgrading/upgrading-to-v3.md).

# Upgrading to v3

If you’ve written a custom Module for CMS version 2.x, you will need to make several code changes to make it work and look correct in CMS version 3.

Please note, we’ve addressed the changes from 1.8 to version 2.x in an earlier page: <https://xibo.org.uk/docs/developer/upgrading-your-custom-module-to-cms-version-2> — please make sure you have done those changes first.

**Request/Response objects**

In version 3 of the CMS we use PSR request and response objects liberally throughout the application code base. This affects the Module edit and settings methods, which now have the following signature:

{% code title="Module method signatures" %}

```php
/**
 * Edit Widget
 * @param \Slim\Http\ServerRequest $request
 * @param \Slim\Http\Response $response
 * @return \Slim\Http\Response
 * @throws GeneralException
 */
public function edit(Request $request, Response $response): Response;

/**
 * Module Settings
 * @param \Slim\Http\ServerRequest $request
 * @param \Slim\Http\Response $response
 * @throws GeneralException
 * @return \Slim\Http\Response
 */
public function settings(Request $request, Response $response): Response;
```

{% endcode %}

In most cases you will return the `$response` provided without modification, however you are free to adjust it if necessary, for example to add some headers, or change the return code.

**Sanitizer**

Version 3 has a new Sanitizer library, which is loaded and accessed in a different way. First get the request parameters using `$request->getParams()`, then pass those into the Sanitizer and receive back a new Sanitizer object which you can pull sanitized parameters from.

{% code title="Using the Sanitizer" %}

```php
$sanitizedParams = $this->getSanitizer($request->getParams());
$name = $sanitizedParams->getString('name');
```

{% endcode %}


---

# 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/upgrading/upgrading-to-v3.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.
