PHPackages                             deliciousbrains/wp-auto-login - 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. deliciousbrains/wp-auto-login

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

deliciousbrains/wp-auto-login
=============================

WordPress library for generating automatic login URLs for users

1.4.0(11mo ago)175.0k8[1 PRs](https://github.com/deliciousbrains/wp-auto-login/pulls)GPL-2.0-or-laterPHP

Since Aug 29Pushed 11mo ago2 watchersCompare

[ Source](https://github.com/deliciousbrains/wp-auto-login)[ Packagist](https://packagist.org/packages/deliciousbrains/wp-auto-login)[ RSS](/packages/deliciousbrains-wp-auto-login/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (7)Used By (0)

Delicious Brains Automatic Logins
=================================

[](#delicious-brains-automatic-logins)

WordPress library for generating automatic login URLs for users

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

[](#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](https://github.com/deliciousbrains/wp-migrations) 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
------------

[](#installation)

- `composer require deliciousbrains/wp-auto-login`
- Bootstrap the package by adding `\DeliciousBrains\WPAutoLogin\AutoLogin::instance();` to an mu-plugin.

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

- A custom WP-CLI parent command name (default: `'dbi'`)
- A global default expiry time in seconds (default: `10368000` - 120 days)

These options are explained below.

Use
---

[](#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',  );`

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
------

[](#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',  );`

will make the commands to be like:

`wp autologin purge_autologin_keys`

### 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](https://developer.wordpress.org/plugins/cron/). 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

[](#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   [--expiry=]`

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 . 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`

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance51

Moderate activity, may be stable

Popularity29

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 51.8% 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 ~273 days

Recently: every ~341 days

Total

6

Last Release

348d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c404609458a1a91e293ba27bf9909ed84785fe13a30f8e731e24d851fbdbe4f2?d=identicon)[deliciousbrains](/maintainers/deliciousbrains)

---

Top Contributors

[![rosswintle](https://avatars.githubusercontent.com/u/1532368?v=4)](https://github.com/rosswintle "rosswintle (29 commits)")[![polevaultweb](https://avatars.githubusercontent.com/u/1770201?v=4)](https://github.com/polevaultweb "polevaultweb (16 commits)")[![colorful-tones](https://avatars.githubusercontent.com/u/405912?v=4)](https://github.com/colorful-tones "colorful-tones (7 commits)")[![sanjucta](https://avatars.githubusercontent.com/u/4763997?v=4)](https://github.com/sanjucta "sanjucta (2 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (2 commits)")

### Embed Badge

![Health badge](/badges/deliciousbrains-wp-auto-login/health.svg)

```
[![Health](https://phpackages.com/badges/deliciousbrains-wp-auto-login/health.svg)](https://phpackages.com/packages/deliciousbrains-wp-auto-login)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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