Anvil
Anvil - The mobile companion for Laravel Forge. Available now. Download for iOS

Introduction

Latest Version on Packagist Run Tests StyleCI Code Coverage Quality Score Total Downloads

A powerful Laravel package that places your application into read-only mode with advanced features for maintenance, security, and access control.

Features

  • Simple Configuration: Enable/disable with a single .env flag
  • IP Whitelist/Blacklist: Control access by IP address with CIDR support
  • Role-Based Exceptions: Allow specific user roles to bypass lockout
  • Custom Responses: View, JSON, or custom response types
  • API Support: Automatic API detection with JSON responses
  • Route Patterns: Whitelist routes by pattern or name
  • Health Check Endpoint: Built-in monitoring endpoint
  • Cache Integration: Performance optimization with configurable caching
  • Event System: Listen to lockout events for logging and monitoring
  • Artisan Commands: Manage lockout via command line
  • Blade Directives: Conditional rendering based on lockout status

Quick Start

  1. Install the package:
1composer require rappasoft/lockout
  1. Enable lockout:
1# In .env
2APP_READ_ONLY=true
  1. That's it! Your application is now in read-only mode.

Use Cases

  • Maintenance Mode: Put your application in maintenance while keeping it accessible
  • Emergency Lockdown: Quickly disable write operations during security incidents
  • Scheduled Maintenance: Allow read access while performing updates
  • Demo Environments: Prevent data modification in demo/staging environments
  • Access Control: Combine with IP whitelisting for secure maintenance access

Requirements

  • PHP 8.2+
  • Laravel 11.x or 12.x

Documentation