PHPackages                             sharq-labs/laravel-access-guard - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. sharq-labs/laravel-access-guard

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

sharq-labs/laravel-access-guard
===============================

This is my package laravel-access-guard

v1.4.1(1y ago)054MITPHPPHP ^8.2|^8.3

Since Nov 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/sharq-labs/laravel-access-guard)[ Packagist](https://packagist.org/packages/sharq-labs/laravel-access-guard)[ Docs](https://github.com/sharq-labs/laravel-access-guard)[ GitHub Sponsors](https://github.com/sharq-labs)[ RSS](/packages/sharq-labs-laravel-access-guard/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (9)Versions (28)Used By (0)

Laravel Access Guard
====================

[](#laravel-access-guard)

[![Latest Version on Packagist](https://camo.githubusercontent.com/289992e641df0aa3a776acb6cbf3ceef8db7356b26b01a15304323703395ec48/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73686172712d6c6162732f6c61726176656c2d6163636573732d67756172642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sharq-labs/laravel-access-guard)[![GitHub Tests Action Status](https://camo.githubusercontent.com/da8c7de88d97ba4854b63de38ef3d2700064ef6b648605c3d5b9ecac192ef123/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73686172712d6c6162732f6c61726176656c2d6163636573732d67756172642f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/sharq-labs/laravel-access-guard/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/ca02f961c8d1951531ad3ac0c70cc05dc88888074d12abaa2ea6c35e1c973c81/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73686172712d6c6162732f6c61726176656c2d6163636573732d67756172642f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/sharq-labs/laravel-access-guard/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/90daeec7a365868c1fcfc042ccfb910bef2472271992b3a0335df81b0ab2d00c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73686172712d6c6162732f6c61726176656c2d6163636573732d67756172642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sharq-labs/laravel-access-guard)

Laravel Access Guard is a robust package to add access restrictions to specific routes in your Laravel application. It supports authentication through email and IP-based access controls, with OTP verification and browser session management.

Features
--------

[](#features)

- Access control based on email and IP.
- OTP verification for enhanced security.
- Configurable session expiration time.
- Flexible browser session tracking.
- Easy-to-use middleware for access verification.

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

[](#installation)

You can install the package via Composer:

```
composer require sharq-labs/laravel-access-guard
```

run the migrations:

```
php artisan migrate
```

Publish the configuration file:

```
php artisan vendor:publish --tag="laravel-access-guard-config"
```

Usage
-----

[](#usage)

Add the VerifyAccess middleware to routes that need access restrictions:

php

```
use Sharqlabs\LaravelAccessGuard\Http\Middleware\VerifyAccess;

Route::middleware([VerifyAccess::class])->group(function () {
    Route::get('/protected-route', [ProtectedController::class, 'index']);
});
```

Usage in Laravel Project
------------------------

[](#usage-in-laravel-project)

After installing your package in a Laravel project, use the following commands:

Add Domain:

```
php artisan access-guard:add-domain --domain=google.com
```

Add Email:

```
 php artisan access-guard:add-record --email="user@example.com"
```

Show Whitelisted Email

```
php artisan access-guard:show-whitelisted
```

Remove Whitelisted IP

```
php artisan access-guard:remove-whitelisted --email="user@example.com"
```

Environment Variables Configuration
===================================

[](#environment-variables-configuration)

This document provides details on the environment variables used for configuring the system.

---

Session Configuration
---------------------

[](#session-configuration)

VariableDescriptionDefault Value`SESSION_TOKEN_EXPIRY_DAYS`Defines the session token expiration in days.`7`---

OTP (One-Time Password) Configuration
-------------------------------------

[](#otp-one-time-password-configuration)

VariableDescriptionDefault Value`OTP_EXPIRES_IN_MINUTES`Specifies the OTP expiration time in minutes.`10`---

Rate Limiting Configuration
---------------------------

[](#rate-limiting-configuration)

VariableDescriptionDefault Value`ACCESS_GUARD_RATE_LIMIT_REQUESTS`Maximum number of requests allowed within the rate-limit window.`500``ACCESS_GUARD_RATE_LIMIT_RESET_INTERVAL`Duration (in minutes) for the rate-limit to reset.`1`---

Session Driver Configuration
----------------------------

[](#session-driver-configuration)

VariableDescriptionDefault Value`ACCESS_GUARD_SESSION_DRIVER`Session driver used for Access Guard.`file`---

### Notification Email Settings

[](#notification-email-settings)

VariableDescriptionDefault Value`ACCESS_GUARD_NOTIFICATION_EMAILS`Comma-separated list of recipient email addresses for notifications.`""` (empty string)`ACCESS_GUARD_ERROR_NOTIFICATIONS_ENABLED`Enable or disable error notifications.`false``ACCESS_GUARD_VERIFY_EMAIL_ENABLED`Enable or disable email verification notifications.`false`### Basic Auth Authentication Settings

[](#basic-auth-authentication-settings)

```
| Variable                   | Description                                       | Default Value |
|----------------------------|---------------------------------------------------|---------------|
| `ACCESS_GUARD_USERNAME`    | The username used for Basic Authentication.       | `admin`       |
| `ACCESS_GUARD_PASSWORD`    | The password used for Basic Authentication.       | `secret`      |

```

### Notes:

[](#notes)

- Ensure these variables are set in your `.env` file for proper configuration.
- Default values are provided as a guideline and can be adjusted to meet specific application needs.
- Use descriptive comments in your `.env` file for better readability and maintenance.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

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

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [sharq-labs](https://github.com/sharq-labs)

License
-------

[](#license)

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

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

27

Last Release

578d ago

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

v1.3.7PHP ^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/be48a6126da311a8ee64e3b32e85985e3878df083256f370b6b82318783e91fe?d=identicon)[developer-kareem-elsharkawy](/maintainers/developer-kareem-elsharkawy)

---

Top Contributors

[![sharq-labs](https://avatars.githubusercontent.com/u/108046720?v=4)](https://github.com/sharq-labs "sharq-labs (30 commits)")

---

Tags

laravelsharq-labslaravel-access-guard

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/sharq-labs-laravel-access-guard/health.svg)

```
[![Health](https://phpackages.com/badges/sharq-labs-laravel-access-guard/health.svg)](https://phpackages.com/packages/sharq-labs-laravel-access-guard)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M101](/packages/dedoc-scramble)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[wnx/laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.

213421.2k2](/packages/wnx-laravel-backup-restore)

PHPackages © 2026

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