Download the PHP package codemonauts/craft-basicauth without Composer

On this page you can find all versions of the php package codemonauts/craft-basicauth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package craft-basicauth

HTTP Basic Authentication for Craft CMS

A plugin for Craft CMS that provides HTTP Basic Authentication (BasicAuth) within templates.

Requirements

Installation

Open your terminal and go to your Craft project:

Apache

I you are using Apache to host your CraftCMS, you have to tell Apache to pass the Authorization header (which contains the basic auth data) to PHP (See the Dokumenation). Otherwise Craft will never see any credentials and will continue to show you the dialog to enter your username and password. This can either be set directly in the Apache config file or in your .htaccess:

Settings

On the settings page in the control panel you can add credentials to use for authentication.

You can add a list of IP addresses and subnets (v4 and v6) that have access without any credentials. Use the CIDR notation for subnets.

These settings supports the project config if enabled.

{% basicauth %} Tag

In your templates you can require BasicAuth:

Parameters

The {% basicauth %} tag supports the following parameters:`

require

This specifies the type of check to be made. You can check against a single user, a group of user, any valid user and also accept any provided credentials.

This parameter is required.

site

This specifies the site handle for which the authentication should be made. The Authentication is only enforced when the current site handle is the same as specified.

env

This specifies the environment for which the authentication should be made. The Authentication is only enforced when the current environment is the same as specified.

if

Only activates the BasicAuth if a certain condition is met.

Globals

This plugin provides two global variables with the credentials of the user:

Why should I use this plugin and not the webserver module?

May you ask yourself why you should use this plugin and not the Basic Authentication provided by the webserver? Here are some aspects:

  1. You have full control of the Basic Authentication without your DevOps friends.
  2. You can add the {% basicauth %} wherever you need it: In your central layout for all pages or only in one special template with some fancy conditions.
  3. You can use conditions from Craft. For example: {% basicauth require valid if not currentUser %}

With ❤ by codemonauts


All versions of craft-basicauth with dependencies

PHP Build Version
Package Version
Requires craftcms/cms Version ^4.0.0-alpha.1
symfony/http-foundation Version ^5.3.1
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package codemonauts/craft-basicauth contains the following files

Loading the files please wait ....