PHPackages                             a2zwebltd/laravel-dev-mode - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. a2zwebltd/laravel-dev-mode

ActiveLibrary[Testing &amp; Quality](/categories/testing)

a2zwebltd/laravel-dev-mode
==========================

A lightweight Laravel package that lets developers temporarily bypass Gate authorization for testing and debugging with time-limited, IP-restricted access.

v1.2.0(1mo ago)3795↓33.3%MITPHPPHP ^8.2CI passing

Since Sep 30Pushed 7mo agoCompare

[ Source](https://github.com/a2zwebltd/laravel-dev-mode)[ Packagist](https://packagist.org/packages/a2zwebltd/laravel-dev-mode)[ Docs](https://github.com/a2zwebltd/laravel-dev-mode)[ RSS](/packages/a2zwebltd-laravel-dev-mode/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (5)Used By (0)

Laravel Dev Mode
================

[](#laravel-dev-mode)

A lightweight Laravel package to temporarily disable Gate authorization for trusted developers.

[![Packagist Version](https://camo.githubusercontent.com/33757199cce6371af2f5b11f4abb83cb45444c48f3886f57612deb40c245ef5c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61327a7765626c74642f6c61726176656c2d6465762d6d6f64652e737667)](https://packagist.org/packages/a2zwebltd/laravel-dev-mode)[![Downloads](https://camo.githubusercontent.com/b7d19fb8830a1d93ac91468fe61d03d0ed6b62359844df456582084521f3ff62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61327a7765626c74642f6c61726176656c2d6465762d6d6f64652e737667)](https://packagist.org/packages/a2zwebltd/laravel-dev-mode)[![PHP](https://camo.githubusercontent.com/9d9ec35e438d32eee58734a510238e61050b48e92f67595cd0047b61f5ece336/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e332d626c7565)](https://camo.githubusercontent.com/9d9ec35e438d32eee58734a510238e61050b48e92f67595cd0047b61f5ece336/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e332d626c7565)[![Laravel](https://camo.githubusercontent.com/4744d96ba069d28fc7bb7b272a22125fa0fc7aefabf4b0ecd0791fc9f0ad523b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d25354531322e302d626c7565)](https://camo.githubusercontent.com/4744d96ba069d28fc7bb7b272a22125fa0fc7aefabf4b0ecd0791fc9f0ad523b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d25354531322e302d626c7565)

This package lets developers temporarily bypass Laravel’s authorization system (Gates) to gain full access for testing or debugging. Access is automatically revoked after a configurable duration (default: 10 minutes). Security is enforced by limiting activation to a specific IP address and user combination.

It is designed for development environments. If you choose to enable it in production, be aware of the security implications. Activation still requires server access, so only privileged users can enable or disable Dev Mode.

Features
--------

[](#features)

- Temporarily bypasses Laravel Gates for a specific user and IP.
- Grants all abilities via a `Gate::before` hook integrated with Laravel’s authorization system.
- Access is time-limited through cache TTL (default: 600 seconds).
- Includes simple Artisan commands and a service API for programmatic control.
- Automatically revokes access after expiration.
- Provides IP-based restriction for additional security.
- Ships with an auto-discovered service provider and configurable TTL.
- Intended for development use; can be used in production with caution and proper access control.

How it works
------------

[](#how-it-works)

The package registers a `Gate::before` callback through its service provider.
When Dev Mode is active, the callback grants all abilities to the specified user if the request originates from the whitelisted IP.
Dev Mode status is stored in Laravel’s cache using keys like `dev-mode:{user_id}`, with automatic expiration after the configured TTL.

---

Requirements
------------

[](#requirements)

- PHP: ^8.3
- Laravel: ^12.0

---

Installation
------------

[](#installation)

Install via Composer:

```
composer require a2zwebltd/laravel-dev-mode
```

Publish the config:

```
php artisan vendor:publish --provider="A2ZWeb\DevMode\ServiceProvider"
```

---

Configuration
-------------

[](#configuration)

- **Config file:** `config/dev-mode.php` (publishable)
- **Environment variable:** `DEV_MODE_TTL` (defaults to 600 seconds)
- **Service Provider:** `A2ZWeb\DevMode\ServiceProvider` (auto-discovered)
- **Cache key format:** `dev-mode:{user_id}`
- **Storage driver:** uses Laravel’s default cache backend

Example `.env`:

```
DEV_MODE_TTL=600
```

---

Usage
-----

[](#usage)

Dev Mode temporarily disables authorization checks for the defined user, but only when requests come from the registered IP and while TTL is valid.

### Enable Dev Mode

[](#enable-dev-mode)

```
php artisan dev-mode:enable --user=123 --ip=192.168.1.1
```

This command grants full access for the given user and IP combination for the configured TTL (default: 10 minutes).

### Disable Dev Mode

[](#disable-dev-mode)

```
php artisan dev-mode:disable --user=123
```

*Tip:* You can include this command as a task inside the `deployer` script.

### Programmatic usage

[](#programmatic-usage)

```
use A2ZWeb\DevMode\DevModeService;

$devMode = app(DevModeService::class);

// Enable for user and IP
$devMode->enable($user, '192.168.1.1');

// Check status
if ($devMode->isEnabled($user, request()->ip())) {
    // All abilities granted via Gate::before
}

// Disable
$devMode->disable($user);
```

Here’s a clean documentation section you can add under **Usage** or after **Programmatic usage** in your README.md:

---

### Conditional developer tools access

[](#conditional-developer-tools-access)

You can use the `DevModeService` check to conditionally enable developer tools such as **Laravel Debugbar**, **Telescope**, or any custom admin utilities for selected developers only.

Example:

```
use A2ZWeb\DevMode\DevModeService;

$devMode = app(DevModeService::class);

if ($devMode->isEnabled(auth()->user(), request()->ip())) {
    // Show or enable developer-only tools
    \Debugbar::enable();
} else {
    \Debugbar::disable();
}
```

This lets you keep production safe while still giving specific developers full diagnostic visibility. You can apply the same logic to any tool or section of your app that should remain hidden for normal users.

---

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover a security vulnerability, please report it responsibly through private communication with the maintainers.

---

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

Credits
-------

[](#credits)

Developed and maintained by the **A2Z WEB** crew:

- [Amir Yeganemehr](https://github.com/yeganemehr)
- [Dawid Makowski](https://github.com/makowskid)
- Website:
- GitHub:
- X/Twitter: [@a2zweb\_co](https://twitter.com/a2zweb_co)

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance76

Regular maintenance activity

Popularity22

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 57.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~59 days

Total

4

Last Release

44d ago

PHP version history (2 changes)v1.0.0PHP ^8.3

v1.2.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b500dd3d9b470b50b1ed911cd24a6fdcce51dd97dceb4f97879f727a14495a8?d=identicon)[dawid-makowski](/maintainers/dawid-makowski)

---

Top Contributors

[![yeganemehr](https://avatars.githubusercontent.com/u/16887332?v=4)](https://github.com/yeganemehr "yeganemehr (4 commits)")[![makowskid](https://avatars.githubusercontent.com/u/6271194?v=4)](https://github.com/makowskid "makowskid (3 commits)")

---

Tags

developer-toolslaravelphptestinglaraveldevelopmentauthorizationgatesbypassdev mode

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/a2zwebltd-laravel-dev-mode/health.svg)

```
[![Health](https://phpackages.com/badges/a2zwebltd-laravel-dev-mode/health.svg)](https://phpackages.com/packages/a2zwebltd-laravel-dev-mode)
```

###  Alternatives

[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[hotmeteor/spectator

Testing helpers for your OpenAPI spec

3021.4M1](/packages/hotmeteor-spectator)[orchestra/workbench

Workbench Companion for Laravel Packages Development

8017.0M43](/packages/orchestra-workbench)[guanguans/laravel-soar

SQL optimizer and rewriter for laravel. - laravel 的 SQL 优化器和重写器。

2227.8k](/packages/guanguans-laravel-soar)[spurwork/spectator

Testing helpers for your OpenAPI spec

3021.5k](/packages/spurwork-spectator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
