Download the PHP package deliciousbrains/wp-auto-login without Composer

On this page you can find all versions of the php package deliciousbrains/wp-auto-login. 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 wp-auto-login

Delicious Brains Automatic Logins

WordPress library for generating automatic login URLs for users

Requirements

This package is designed to be used on a WordPress site project, not for a plugin or theme.

It needs to be running PHP 5.3 or higher.

It requires the deliciousbrains/wp-migration package and so the site will need to be set up to run wp dbi migrate as a last stage build step in your deployment process.

You should also run wp dbi migrate after updating the package to make sure you have up to date database tables.

It automatically purges expired keys from the database daily, and there are WP-CLI commands to:

  1. Manually purge expired keys
  2. Manually generate an auto-login URL

Installation

There are two parameters you can pass when bootstrapping the package:

Use

To generate a URL that will automatically login a user and land them at a specific URL use this function:

dbi_get_auto_login_url( $destination_url, $user_id, [$query_params], [$expiry], [$one_time] );

The URL will expire in 120 days. However, you can pass the number of seconds the URL will be valid for as the fourth argument, e.g valid for 1 day:

dbi_get_auto_login_url( $destination_url, $user_id, $query_params, 86400 );

You can also specify your own global default for expiry when bootstrapping the package as explained in the "Installation" section above. Use:

\DeliciousBrains\WPAutoLogin\AutoLogin::instance( 'dbi', <expiry_in_seconds> );

There is also an option to generate links that can only be used once:

dbi_get_auto_login_url( $destination_url, $user_id, $query_params, null, true );

WP-CLI

There are two WP-CLI commands.

The commands are added as sub-commands of a parent command. By default the parent command is dbi (for example: wp dbi purge_autologin_keys). But this can be changed when you bootstrap the package.

For example, doing:

\DeliciousBrains\WPAutoLogin\AutoLogin::instance( 'autologin', <expiry_in_seconds> );

will make the commands to be like:

wp autologin purge_autologin_keys

purge_autologin_keys

This command purges any expired keys from the WordPress database. On most sites this happens daily, automatically, with a WP-Cron task. But if you have disabled WP-Cron or want to do this manually for whatever reason then this WP-CLI command lets you do it:

wp dbi purge_autologin_keys

auto_login_url

This command manually generates an auto-login URL that logs a specified user in and sends them to a specified URL.

wp dbi auto_login_url <user_id> <url> [--expiry=<seconds>]

The default expiry is used, but you can override it for each link that you create with this command by specifying your own expiry in seconds.

Example:

wp dbi auto_login_url 12345 https://example.com/dashboard --expiry=21600

Will generate a link that logs in the user with ID 12345 and takes them to https://example.com/dashboard. The link will be valid for 6 hours.

You can add --one-time to generate a single-use link:

wp dbi auto_login_url 12345 https://example.com/dashboard --one-time


All versions of wp-auto-login with dependencies

PHP Build Version
Package Version
Requires deliciousbrains/wp-migrations Version ^2.0
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 deliciousbrains/wp-auto-login contains the following files

Loading the files please wait ....