PHPackages                             queue-fair/magentoadapter - 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. queue-fair/magentoadapter

ActiveLibrary

queue-fair/magentoadapter
=========================

The Queue-Fair Server-Side Adapter keeps your queues secure and prevents a crashed site. You will need a Queue-Fair account - get one at https://queue-fair.com/free-trial

v2.6.1(3y ago)097MITPHPPHP &gt;=5.4.0

Since Jul 23Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Queue-Fair/magento)[ Packagist](https://packagist.org/packages/queue-fair/magentoadapter)[ RSS](/packages/queue-fair-magentoadapter/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (9)DependenciesVersions (10)Used By (0)

---

Queue-Fair Adapter for Magento README &amp; Installation Guide
--------------------------------------------------------------

[](#queue-fair-adapter-for-magento-readme--installation-guide)

Queue-Fair can be added to any Magento installation easily in minutes. You will need a Queue-Fair account - please visit  if you don't already have one. You should also have received our Technical Guide. You can find out all about Queue-Fair at

Client-Side JavaScript Adapter
------------------------------

[](#client-side-javascript-adapter)

Most of our customers prefer to use the Client-Side JavaScript Adapter, which is suitable for all sites that wish solely to protect against overload.

To add the Queue-Fair Client-Side JavaScript Adapter to your Magento installation, you don't need the PHP files included in this extension.

Instead, perform the following steps:

- Login to your Magento installation as Admin
- Select Content -&gt; Configuration from the left nav
- To add the Adapter to all pages on your Magento site, tap Edit for the Global record
- In Other Settings, expand HTML Head
- In Scripts and Style Sheets, copy and paste the following line of code:

```
`

```

- Replace CLIENT\_NAME with the account system name visibile on the Account -&gt; Your Account page of the Queue-Fair Portal
- Save Configuration
- Flush Cache when prompted

You shoud now see the Adapter tag when you perform View Source after refreshing your pages.

There is a helpful video of these steps in action at

And you're done! Your queues and activation rules can now be configured in the Queue-Fair Portal.

Server-Side Adapter
-------------------

[](#server-side-adapter)

The Server-Side Adapter means that your Magento server communicates directly with the Queue-Fair servers, rather than your visitors' browsers.

This can introduce a dependency between our systems, which is why most customers prefer the Client-Side Adapter.

The Server-Side Adapter is preferred in the following use cases:

- where you have technically skilled visitors or high value limited quantity product, and people may attempt to skip the queue, OR
- where it is anticipated that your web server will not cope with the volume of traffic to your home or landing page AND you do not or cannot use the Direct Link integration method (see Technical Guide).

The Server-Side Adapter is a small PHP library that will run when visitors access your site. It periodically checks to see if you have changed your Queue-Fair settings in the Portal, but other than that if the visitor is requesting a page that does not match any queue's Activation Rules, it does nothing.

If a visitor requests a page that DOES match any queue's Activation Rules, the Adapter makes a determination whether that particular visitor should be queued. If so, the visitor is sent to our Queue Servers and execution and generation of the page for that HTTP request for that visitor will cease. If the Adapter determines that the visitor should not be queued, it sets a cookie to indicate that the visitor has been processed and your page executes and shows as normal.

Thus the Server-Side Adapter prevents visitors from skipping the queue by disabling the Client-Side JavaScript Adapter, and also reduces load on your Magento server when things get busy.

You will need PHP version 5.4 or above to run the Server-Side Adapter.

Here's every keystroke for the install.

**1.** Create a readable, writable and executable folder so that your Queue-Fair settings can be locally saved (necessary for performance of your web server under load):

```
    sudo mkdir /opt/qfsettings
    sudo chmod 777 /opt/qfsettings

```

Note: The settings folder can go anywhere, but for maximum security this should not be in your web root. The executable permission is needed on the folder so that the Adapter can examine its contents. You can see your Queue-Fair settings in the Portal File Manager - they are updated when you hit Make Live.

**2.** **IMPORTANT:** Make sure the system clock on your webserver is accurately set to network time! On unix systems, this is usually done with the ntp package. It doesn't matter which timezone you are using. For Debian/Ubuntu:

```
    sudo apt-get install ntp

```

**3.** Go to your Magento installation:

```
    cd /path/to/magento

```

**4.** Add the Server-Side extension to your composer requirements:

```
    composer require queue-fair/magadapter --no-update

```

**5.** Update composer

```
    composer update

```

This will create a new folder `/path/to/magento/vendor/queue-fair/magadapter`

**6.** Next, edit `vendor/queue-fair/magadapter/QueueFairConfig.php`

```
    nano vendor/queue-fair/magadapter/QueueFairConfig.php

```

**7.** At the top of `QueueFairConfig.php` set your account name and account secret to the account System Name and Account Secret shown on the Your Account page of the Queue-Fair portal.

**8.** Change the `settingsFileCacheLocation` to match the folder path to the settings folder you created above.

**9.** Note the `settingsFileCacheLifetimeMinutes` setting - this is how often your web server will check for updated settings from the Queue-Fair queue servers (which change when you hit Make Live). The default value is 5 minutes. You can set this to -1 to disable local caching but **DON'T DO THIS** on your production machine/live queue with real people, or your server may collapse under load.

**10.** Note the `adapterMode` setting. "safe" is recommended - we also support "simple" - see the Technical Guide for further details.

**11.** **IMPORTANT** Note the `debug` setting - this is set to true by default, BUT you MUST set debug to false on production machines/live queues as otherwise your web logs will rapidly become full. You can safely set it to a single IP address to just output debug information for a single visitor, even on a production machine.

The debug logging statements will appear in whichever file php has been set-up to output error message information. If using Apache, it will appear in the apache error.log, and you can see the messages with

```
    sudo tail -f /var/log/apache2/error.log | sed 's/\\n/\n/g'

```

**12.** When you have finished making changes to `QueueFairConfig.php`, hit `CTRL-O` to save and `CTRL-X` to exit nano.

To make the Adapter actually run, you need to edit the master Magento index.php file. **Make sure you make a back up copy of the index.php file before editing.**

```
    nano /path/to/magento/pub/index.php

```

and just after the opening `
