PHPackages                             brasstacksweb/craft-basic-auth - 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. brasstacksweb/craft-basic-auth

ActiveCraft-plugin[Authentication &amp; Authorization](/categories/authentication)

brasstacksweb/craft-basic-auth
==============================

A Craft CMS plugin to configure HTTP Basic Authentication for your site.

v2.0.7(1y ago)030proprietaryPHPPHP ^8.2

Since Jun 9Pushed 1y agoCompare

[ Source](https://github.com/brasstacksweb/craft-basic-auth)[ Packagist](https://packagist.org/packages/brasstacksweb/craft-basic-auth)[ RSS](/packages/brasstacksweb-craft-basic-auth/feed)WikiDiscussions craft-5 Synced today

READMEChangelogDependencies (6)Versions (17)Used By (0)

Craft Basic Auth
================

[](#craft-basic-auth)

A flexible and powerful Craft CMS plugin that adds HTTP Basic Authentication to your websites with intelligent rule-based configuration.

Overview
--------

[](#overview)

This plugin allows you to protect your Craft CMS sites with HTTP Basic Authentication based on flexible trigger conditions including environment names and domain patterns. Perfect for protecting development, staging, or specific production environments while maintaining fine-grained control over what gets protected.

[![Settings screenshot](/docs/images/settings.png "Settings")](/docs/images/settings.png)

### Key Features

[](#key-features)

- Flexible Rule System: Create authentication rules triggered by environment or domain patterns
- Environment-Aware: Automatically detects current environment using `CRAFT_ENVIRONMENT`
- Smart Protection: Define protected and excepted paths with wildcard pattern support
- Secure Credentials: Password fields support Craft's environment variable syntax

### Perfect For

[](#perfect-for)

- Development Teams: Protect staging environments while allowing webhook access
- Agencies: Manage authentication across multiple client sites from one interface
- Multi-site Setups: Different authentication rules for different sites in the same Craft installation
- Security-Conscious Sites: Add an extra layer of protection to specific admin areas

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

[](#requirements)

This plugin requires Craft CMS 5.0 or later, and PHP 8.2 or later.

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

[](#installation)

You can install this plugin from the Plugin Store or with Composer.

#### From the Plugin Store

[](#from-the-plugin-store)

Go to the Plugin Store in your project’s Control Panel and search for “Basic Auth”. Then press “Install”.

#### With Composer

[](#with-composer)

Open your terminal and run the following commands:

```
# go to the project directory
cd /path/to/my-project.test

# tell Composer to load the plugin
composer require brasstacksweb/craft-basic-auth

# tell Craft to install the plugin
./craft plugin/install craft-basic-auth
```

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

[](#configuration)

Configure authentication rules through the plugin's settings page in your Craft control panel. Each rule can be triggered by:

- Environment names (e.g., dev, staging, production)
- Domain patterns (e.g., \*.staging.com, dev.example.com)

Rules support wildcard patterns, path exceptions, and custom failure messages.

[![New Condition screenshot](/docs/images/condition.png "New Condition")](/docs/images/condition.png)

Testing
-------

[](#testing)

This plugin includes a test suite to verify its functionality.

### Running Tests

[](#running-tests)

```
# Install dev dependencies if you haven't already
composer install

# Run all tests
composer test
```

### What's Covered

[](#whats-covered)

The test suite covers:

1. **Plugin Tests** - Uses PHPUnit mocks to simulate Craft dependencies:
    - Condition matching logic
    - Path protection and exception handling
    - Authentication functionality

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance48

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

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

Total

15

Last Release

381d ago

Major Versions

v1.0.1 → v2.0.32025-06-10

v1.0.2 → v2.0.42025-06-11

v1.0.3 → v2.0.52025-06-11

1.0.4 → v2.0.62025-06-11

v1.0.6 → v2.0.72025-06-18

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

v2.0.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/264278167?v=4)[trevorbtw](/maintainers/trevorbtw)[@trevorbtw](https://github.com/trevorbtw)

---

Top Contributors

[![brasstacksweb](https://avatars.githubusercontent.com/u/168479622?v=4)](https://github.com/brasstacksweb "brasstacksweb (27 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/brasstacksweb-craft-basic-auth/health.svg)

```
[![Health](https://phpackages.com/badges/brasstacksweb-craft-basic-auth/health.svg)](https://phpackages.com/packages/brasstacksweb-craft-basic-auth)
```

###  Alternatives

[spicyweb/craft-neo

A Matrix-like field type with block hierarchy

393813.5k10](/packages/spicyweb-craft-neo)[verbb/formie

The most user-friendly forms plugin for Craft.

102393.6k70](/packages/verbb-formie)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

54681.3k19](/packages/solspace-craft-freeform)[verbb/vizy

A flexible visual editor field for Craft.

4250.4k](/packages/verbb-vizy)[verbb/hyper

A user-friendly links field for Craft.

24147.8k12](/packages/verbb-hyper)[verbb/knock-knock

Password protect your public facing Craft website with a single password.

17124.9k9](/packages/verbb-knock-knock)

PHPackages © 2026

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