WP plugin for adding basic auth to staging sites

Hello! I’m pretty new to Bedrock/Sage - one problem I ran into was I wanted to conditionally enable HTTP basic auth on staging sites (preferably without modifying the Bedrock environment configs). I created a tiny WordPress plugin to do just this simply by adding credentials to the .env. Feedback / PRs are more than welcome!

Setup:

  1. Add the package to your bedrock installation with composer require aprivette/bedrock-auth and activate the plugin in WordPress.
  2. Add the BASIC_AUTH_USER and BASIC_AUTH_PASS variables to your .env file.
  3. Navigate to the site and it should require you to login.
3 Likes