How to install the accessibility widget in Laravel

This guide walks you through the installation process of the package and configuration of the WCAG accessibility widget in your Laravel application.

Step 1: Package installation

In a Laravel environment, the recommended way to install packages is using Composer.
  1. Install the package:Open your terminal in the root directory of your Laravel application and run:
  2. Publish configuration file:After installation, publish the package configuration file:

Step 2: Website registration and token generation

To allow the widget to connect to the service, you need to generate a unique API token.
  1. Create an account or sign in. No DockAccess account yet? Register (opens in a new tab) using Google, Facebook, GitHub or your own e-mail address and password. Already have one? Sign in (opens in a new tab).

  2. Open your list of sites. In the account menu choose “My sites” (opens in a new tab) and click “Add site” (opens in a new tab).

  3. Enter the address of your site. In the “Domain” field enter the address of the site where you want to use DockAccess, e.g. example.com. The www version works automatically, there is no need to add it. Separate several different domains with commas. Click “Add site”. The address cannot be changed later: for another domain you add a new site. Read more about domains in the documentation (opens in a new tab).

  4. Copy the token. The configuration of the new site opens. Click the copy icon in the “Your token” field.

You can also find the token of every site later in “My sites”, under the address of the site, with a copy icon.

Step 3: Token configuration

After generating your token, add it to your Laravel environment configuration file.
  1. Open the .env file located in the root directory of your application.
  2. Add the following entry:
  3. Save the file.

Step 4: Adding the widget to your application

The package provides a Blade directive that allows you to easily embed the widget anywhere in your application.
  1. Open your main Blade layout file, for example:
  2. Insert the @assistForWCAG directive before the closing </body> tag:

Step 5: Clear configuration cache

After making changes, it is recommended to clear Laravel’s cache:

Step 6: Preview your website

After completing the setup, open your website and verify that the accessibility widget is loaded correctly. Test accessibility features such as:
  • text resizing,
  • contrast adjustments,
  • text-to-speech,
  • keyboard navigation,
  • WCAG accessibility profiles.

Alternative: Manual installation (without the package)

If you cannot use the Composer package, you can manually integrate the widget into your Laravel application.
  1. Get your token:Follow the steps described in “Step 2” above.
  2. Copy the script code:
  3. Add the script to your Blade layout:Open your main layout file, for example:
    Then paste the script before the closing </body> tag.
  4. Replace the token placeholder:Replace _TOKEN_ with your actual token.
  5. Clear cache:
Once completed, the WCAG accessibility widget will be active in your Laravel application.

Related posts

Still looking for answers?

Ask our experts using online chat

Contact us

Newsletter

Accessibility news straight to your inbox

New laws and deadlines, court rulings, enforcement and WCAG changes. A short summary once a week, and an e-mail straight away when something important happens. Unsubscribe at any time.

  • Important changes straight away, the rest in a weekly summary
  • New laws and compliance deadlines
  • Court rulings and enforcement actions
  • Changes to WCAG and other standards

Choose nothing to get everything. Pick categories if you only want some of them.