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(11mo ago)028proprietaryPHPPHP ^8.2

Since Jun 9Pushed 11mo 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 1mo ago

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

34

—

LowBetter than 77% of packages

Maintenance52

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

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

334d 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://www.gravatar.com/avatar/f6affbe47c3af10fa1dd4666a3bdb9feb250ebf500c7d8464e123c1521866281?d=identicon)[trevorbtw](/maintainers/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

[born05/craft-twofactorauthentication

Craft 4 plugin for two-factor or two-step login using Time Based OTP.

36100.1k1](/packages/born05-craft-twofactorauthentication)[flipboxfactory/saml-sp

SAML Service Provider

19101.0k](/packages/flipboxfactory-saml-sp)[verbb/knock-knock

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

17122.8k7](/packages/verbb-knock-knock)[matt-west/craft-recaptcha

Integrate Google’s reCAPTCHA into your forms.

1959.9k1](/packages/matt-west-craft-recaptcha)[jamesedmonston/graphql-authentication

GraphQL authentication for your headless Craft CMS applications.

2917.0k](/packages/jamesedmonston-graphql-authentication)[dukt/social

Let your visitors log into Craft with web services like Facebook, Google, Twitter…

1141.0k5](/packages/dukt-social)

PHPackages © 2026

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