PHPackages                             noq/roomq - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. noq/roomq

ActiveLibrary

noq/roomq
=========

NoQ RoomQ

2.1.2(4y ago)022BSD-3-ClausePHPPHP &gt;=7.3.0

Since Jun 15Pushed 4y ago3 watchersCompare

[ Source](https://github.com/redso/noq-php-sdk)[ Packagist](https://packagist.org/packages/noq/roomq)[ Docs](https://github.com/redso/noq-php-sdk)[ RSS](/packages/noq-roomq/feed)WikiDiscussions main Synced 5d ago

READMEChangelogDependencies (3)Versions (20)Used By (0)

Install
=======

[](#install)

> Download the latest composer package from [here.](https://packagist.org/packages/noq/roomq)

```
composer require noq/roomq
```

RoomQ Backend SDK - PHP
=======================

[](#roomq-backend-sdk---php)

The [RoomQ](https://www.noq.hk/en/roomq) Backend SDK is used for server-side integration to your server. It was developed with PHP.

High Level Logic
----------------

[](#high-level-logic)

[![The SDK Flow](https://raw.githubusercontent.com/redso/roomq.backend-sdk.nodejs/master/RoomQ-Backend-SDK-JS-high-level-logic-diagram.png)](https://raw.githubusercontent.com/redso/roomq.backend-sdk.nodejs/master/RoomQ-Backend-SDK-JS-high-level-logic-diagram.png)

1. End user requests a page on your server
2. The SDK verify if the request contain a valid ticket and in Serving state. If not, the SDK send him to the queue.
3. End user obtain a ticket and wait in the queue until the ticket turns into Serving state.
4. End user is redirected back to your website, now with a valid ticket
5. The SDK verify if the request contain a valid ticket and in Serving state. End user stay in the requested page.
6. The end user browses to a new page, and the SDK continue to check if the ticket is valid.

How to integrate
----------------

[](#how-to-integrate)

### Prerequisite

[](#prerequisite)

To integrate with the SDK, you need to have the following information provided by RoomQ

1. ROOM\_ID
2. ROOM\_SECRET
3. ROOMQ\_TICKET\_ISSUER
4. ROOMQ\_STATUS\_API
5. API\_KEY
6. LOCKER\_URL

### Major steps

[](#major-steps)

To validate that the end user is allowed to access your site (has been through the queue) these steps are needed:

1. Initialise RoomQ
2. Determine if the current request page/path required to be protected by RoomQ
3. Initialise Http Context Provider
4. Validate the request
5. If the end user should goes to the queue, set cache control
6. Redirect user to queue

### Integration on specific path

[](#integration-on-specific-path)

It is recommended to integrate on the page/path which are selected to be provided. For the static files, e.g. images, css files, js files, ..., it is recommended to be skipped from the validation. You can determine the requests type before pass it to the validation.

Implementation Example
----------------------

[](#implementation-example)

The following is an RoomQ integration example in php.

```
