Laravel Airlock Renamed to Sanctum


March 24th, 2020


Last week the Laravel blog announced that Laravel Airlock needed to change “due to a trademark dispute regarding the name ‘Airlock.'”

The new name is Laravel Sanctum.

You may even be coming here after seeing an airlock package abandonment warning when installing v1.x versions:

Below you can find a few other details on updating your code if you depend on laravel/airlock.


You need to find/replace anywhere in your code you find Airlock and airlock to Sanctum and sanctum, respectively.

Steps to Update

Everything feature-wise remains the same, but you’ll need to make a few changes to start using the new repo and drop the abandoned laravel/airlock package. The diff of the documentation page could be helpful to follow along if you need to update existing projects.

The rough steps to change from Airlock involve the following:

  1. Add the laravel/sanctum composer dependency
  2. Either publish the sanctum vendor config or move the existing config/airlock.php config
  3. Find/replace Airlock for Sanctum and airlock for sanctum
  • If you’re using the middleware for a SPA, change Airlock to Sanctum
  • Update any environment configuration for AIRLOCK_STATEFUL_DOMAINS to SANCTUM_STATEFUL_DOMAINS
  1. Remove config/airlock.php
  2. Remove laravel/airlock from the project’s composer dependencies

Note: be sure to remember to retain any customizations you’ve made to config/airlock.php

Here are the rough commands for all the steps:

1# Step 1 - install Sanctum
2composer install laravel/sanctum
4# Step 2 - Publish the sanctum vendor config
5php artisan vendor:publish \
6 --provider="Laravel\Sanctum\SanctumServiceProvider"
8# Step 3
9# Manually find/replace Airlock instances in your code
12# Step 4 - if you published config/sanctum.php
13rm config/airlock.php
15# Step 5
16composer remove laravel/airlock

Here’s the example from the documentation for importing the Sanctum middleware, so if you’ve done this already in your project change use Laravel\Airlock\... to reference use Laravel\Sanctum\... instead:

1use Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful;
3'api' => [
4 EnsureFrontendRequestsAreStateful::class,
5 'throttle:60,1',
6 \Illuminate\Routing\Middleware\SubstituteBindings::class,

Learn More

To learn more about using Sanctum, check out the official documenation. The source code is on GitHub at laravel/sanctum.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.