PHPackages                             tkaratug/laravel-domain-whitelist - 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. [Security](/categories/security)
4. /
5. tkaratug/laravel-domain-whitelist

ActiveLibrary[Security](/categories/security)

tkaratug/laravel-domain-whitelist
=================================

A domain wwhitelist checker middleware.

1.2.0(3y ago)131.2k1MITPHPPHP ^7.4|^8.0|^8.1|^8.2

Since Jun 20Pushed 3y ago1 watchersCompare

[ Source](https://github.com/tkaratug/laravel-domain-whitelist)[ Packagist](https://packagist.org/packages/tkaratug/laravel-domain-whitelist)[ Docs](https://github.com/tkaratug/laravel-domain-whitelist)[ GitHub Sponsors](https://github.com/tkaratug)[ RSS](/packages/tkaratug-laravel-domain-whitelist/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (4)Versions (6)Used By (0)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2b6294f211c7958ec78cf02ca904310dd4ea334dbc7cfb43501bbdb20b49674a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746b6172617475672f6c61726176656c2d646f6d61696e2d77686974656c6973742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tkaratug/laravel-domain-whitelist)[![GitHub Tests Action Status](https://camo.githubusercontent.com/063a864bca55cb33069aa54304e05dc2c88f5373cee3d163de5f3a7dc52fd5a3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f746b6172617475672f6c61726176656c2d646f6d61696e2d77686974656c6973742f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/tkaratug/laravel-domain-whitelist/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/8387ad638d577361a4f155d205ba931d60f94031dc082ad7859327bd4df253f3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f746b6172617475672f6c61726176656c2d646f6d61696e2d77686974656c6973742f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/tkaratug/laravel-domain-whitelist/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/2b98a1ee56c5235e95061c1010c5347a5216b7f9bf92ab48780fbccffe4ee126/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746b6172617475672f6c61726176656c2d646f6d61696e2d77686974656c6973742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tkaratug/laravel-domain-whitelist)

---

Introduction
------------

[](#introduction)

This package contains a middleware to check whether the origin domain is in the whitelist. If not it blocks the request.

---

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

[](#installation)

You can install the package via composer:

```
composer require tkaratug/laravel-domain-whitelist
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Tkaratug\LaravelDomainWhitelist\LaravelDomainWhitelistServiceProvider" --tag="domain-whitelist-config"
```

This is the contents of the published config file:

```
return [
    /*
    |---------------------------------------------
    | Domains to allow
    | Leave empty to allow all requests
    |---------------------------------------------
    */
    'domains' => [
        //'*.example.com',
        //'example.com',
    ],

    /*
    |---------------------------------------------
    | Paths to exclude
    |---------------------------------------------
    */
    'excludes' => [
        //'/api/posts',
    ],
];
```

---

Usage
-----

[](#usage)

Packages comes with `DomainWhitelist` middleware. You can register it in `$routeMiddleware` in `app/Http/Kernel.php` file:

```
protected $routeMiddleware = [
    // ...
    'domain_whitelist' => \Tkaratug\LaravelDomainWhitelist\Middlewares\DomainWhitelist::class,
];
```

Use the middleware in any of your routes.

```
Route::middleware('domain_whitelist')->get('/', [HomeController::class, 'index']);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

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

[](#security-vulnerabilities)

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

Credits
-------

[](#credits)

- [Turan Karatuğ](https://github.com/tkaratug)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity68

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 ~304 days

Total

3

Last Release

1184d ago

PHP version history (3 changes)1.0.0PHP ^7.4 || ^8.0

1.1.0PHP ^7.4|^8.0|^8.1

1.2.0PHP ^7.4|^8.0|^8.1|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/50dc98a0c75a1aaba61d52bb073e1b0cbdb17f4d5ed4bd1c694c71784b088e16?d=identicon)[tkaratug](/maintainers/tkaratug)

---

Top Contributors

[![tkaratug](https://avatars.githubusercontent.com/u/4394344?v=4)](https://github.com/tkaratug "tkaratug (20 commits)")

---

Tags

laraveltkaratuglaravel-domain-whitelist

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tkaratug-laravel-domain-whitelist/health.svg)

```
[![Health](https://phpackages.com/badges/tkaratug-laravel-domain-whitelist/health.svg)](https://phpackages.com/packages/tkaratug-laravel-domain-whitelist)
```

###  Alternatives

[spatie/laravel-csp

Add CSP headers to the responses of a Laravel app

8569.6M19](/packages/spatie-laravel-csp)[spatie/laravel-ciphersweet

Use ciphersweet in your Laravel project

416718.4k1](/packages/spatie-laravel-ciphersweet)[tzsk/otp

A secure, database-free One-Time Password (OTP) generator and verifier for PHP and Laravel.

241641.4k1](/packages/tzsk-otp)[dgtlss/warden

A Laravel package that proactively monitors your dependencies for security vulnerabilities by running automated composer audits and sending notifications via webhooks and email

8745.6k](/packages/dgtlss-warden)[ercsctt/laravel-file-encryption

Secure file encryption and decryption for Laravel applications

642.6k](/packages/ercsctt-laravel-file-encryption)[laragear/poke

Keep your forms alive, avoid TokenMismatchException by gently poking your Laravel app

2211.5k](/packages/laragear-poke)

PHPackages © 2026

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