PHPackages                             owenmelbz/domain-enforcement - 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. owenmelbz/domain-enforcement

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

owenmelbz/domain-enforcement
============================

Laravel 5+ middleware to enforce a single domain on your application. e.g non-www. to www.

0.0.7(6y ago)234.9k5MITPHP

Since May 26Pushed 6y agoCompare

[ Source](https://github.com/OwenMelbz/domain-enforcement)[ Packagist](https://packagist.org/packages/owenmelbz/domain-enforcement)[ RSS](/packages/owenmelbz-domain-enforcement/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)DependenciesVersions (8)Used By (0)

Laravel 5+ Domain / APP\_URL Enforcement
========================================

[](#laravel-5-domain--app_url-enforcement)

An automatic piece of middleware for Laravel 5+, which will force users to access your application via what is defined in the APP\_URL - especially useful for SEO forcing non-www users to www etc, unless specified in the ignore list

Usage
-----

[](#usage)

1. Install via composer `composer require owenmelbz/domain-enforcement`
2. Register the service provider - typically done inside the `app.php` providers array e.g `OwenMelbz\DomainEnforcement\DomainEnforcementServiceProvider::class`
3. Add `ENFORCE_DOMAIN=true` to your application environment config e.g `.env`
4. Enjoy your stress free architecture agnostic redirects

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

[](#configuration)

If you publish the config via `php artisan vendor:publish --provider="OwenMelbz\DomainEnforcement\DomainEnforcementServiceProvider"` you can exclude urls from getting enforced.

Why?
----

[](#why)

Too often we've wasted time configuring redirections, with proxy systems like CloudFlare, with apache development machines and nginx production, this removes all the headache and can simply be turned off and on at a whim.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% 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 ~143 days

Recently: every ~214 days

Total

7

Last Release

2460d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1094740?v=4)[Owen Melbourne](/maintainers/OwenMelbz)[@OwenMelbz](https://github.com/OwenMelbz)

---

Top Contributors

[![OwenMelbz](https://avatars.githubusercontent.com/u/1094740?v=4)](https://github.com/OwenMelbz "OwenMelbz (11 commits)")[![lloy0076](https://avatars.githubusercontent.com/u/1174532?v=4)](https://github.com/lloy0076 "lloy0076 (1 commits)")

---

Tags

laravel-5-packagenon-wwwredirectwwwlaravelwwwredirectnon-wwwenforce

### Embed Badge

![Health badge](/badges/owenmelbz-domain-enforcement/health.svg)

```
[![Health](https://phpackages.com/badges/owenmelbz-domain-enforcement/health.svg)](https://phpackages.com/packages/owenmelbz-domain-enforcement)
```

###  Alternatives

[martbock/laravel-diceware

Diceware Passphrase Generator for Laravel

3268.9k](/packages/martbock-laravel-diceware)[orchestra/auth

Auth Component for Orchestra Platform

22108.6k3](/packages/orchestra-auth)[owenmelbz/https-enforcement

Laravel 5.x middleware to enforce https redirection for your app.

252.6k](/packages/owenmelbz-https-enforcement)[ingria/laravel-x509-auth

Laravel 5 Client Certificate auth middleware

375.6k](/packages/ingria-laravel-x509-auth)

PHPackages © 2026

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