PHPackages                             vuetober/rainlab-user-api - 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. vuetober/rainlab-user-api

AbandonedArchivedOctober-plugin[Authentication &amp; Authorization](/categories/authentication)

vuetober/rainlab-user-api
=========================

1.0.0(6y ago)8113[2 issues](https://github.com/scottbedard/rainlab-user-api/issues)PHP

Since Dec 27Pushed 5y ago1 watchersCompare

[ Source](https://github.com/scottbedard/rainlab-user-api)[ Packagist](https://packagist.org/packages/vuetober/rainlab-user-api)[ RSS](/packages/vuetober-rainlab-user-api/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

rainlab-user-api
================

[](#rainlab-user-api)

[![Build status](https://camo.githubusercontent.com/e9c7a276920d7a367f32ff001d530801001bd4af1d637632f9a000b3df66d57e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f73636f74746265646172642f7261696e6c61622d757365722d6170692f54657374)](https://github.com/scottbedard/rainlab-user-api/actions)[![Code coverage](https://camo.githubusercontent.com/c7090a8b183a582800dc41478b7ca39d5c4c92412581135e1a499a3b0ade5ee9/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f73636f74746265646172642f7261696e6c61622d757365722d617069)](https://codecov.io/gh/scottbedard/rainlab-user-api)[![Code style](https://camo.githubusercontent.com/a36e6053fe30949d683ff8f22aaaa286ca2ab45144bfa0c72a7b7177b1164d27/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3132343536333330302f736869656c643f7374796c653d666c6174)](https://github.styleci.io/repos/124563300)[![MIT License](https://camo.githubusercontent.com/8e7b188ec6ab843a2c08cc9c5a11357cd514b2d61df390b09bfbebdc4f7e5a84/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f73636f74746265646172642f7261696e6c61622d757365722d6170693f636f6c6f723d626c7565)](https://github.com/scottbedard/rainlab-user-api/blob/master/LICENSE)

A simple and extendable HTTP API for [RainLab.User](https://github.com/rainlab/user-plugin).

- [Installation &amp; configuration](#installation--configuration)
- [Basic Usage](#basic-usage)
- [Adding middleware](#adding-middleware)
- [Endpoints](#endpoints)

Installation &amp; configuration
--------------------------------

[](#installation--configuration)

To install the API, run the following commands from your root October directory:

```
git clone git@github.com:scottbedard/rainlab-user-api.git plugins/bedard/rainlabuserapi
```

By default, all routes are grouped behind a `/api/rainlab/user` prefix. To override this, add the following to a `.env` file at the root of your October installation. Alternatively, you can use October's [file based configuration](https://octobercms.com/docs/plugin/settings#file-configuration).

```
RAINLAB_USER_API_PREFIX="/your/custom/prefix"

```

To disable the API completely, add the following environment variable:

```
RAINLAB_USER_API_ENABLE=false

```

Basic usage
-----------

[](#basic-usage)

To get the authenticated user, use the `AccountManager` class.

```
use Bedard\RainLabUserApi\Classes\AccountManager;

$user = AccountManager::getAuthenticatedUser();
```

Using this method to fetch the `User` model will trigger a `bedard.rainlabuserapi.afterGetUser` event. This can be useful when other data is needed with the user. As an example, here we'll configure the API to load the user's avatar.

```
public function boot()
{
    Event::listen('bedard.rainlabuserapi.afterGetUser', function ($user) {
        $user->load(['avatar']);
    });
}
```

Adding Middleware
-----------------

[](#adding-middleware)

All endpoints use a base controller that can be extended. This can be used to add middleware that make the responses consistent with the rest of your API. To do this, add the following to your `Plugin.php` file. See the [October documentation](https://octobercms.com/docs/plugin/registration#registering-middleware) for more information on using middleware.

```
public function boot()
{
    \Bedard\RainLabUserApi\Classes\ApiController::extend(function($controller) {
        $controller->middleware('Path\To\Custom\Middleware');
    });
}
```

Endpoints
---------

[](#endpoints)

##### `POST: /api/rainlab/user/auth/login`

[](#post-apirainlabuserauthlogin)

Authenticate a user.

##### `ANY: /api/rainlab/user/auth/logout`

[](#any-apirainlabuserauthlogout)

Log out the authenticated user.

##### `ANY: /api/rainlab/user/auth/stop-impersonation`

[](#any-apirainlabuserauthstop-impersonation)

Stop impersonating a user.

##### `POST: /api/rainlab/user/users`

[](#post-apirainlabuserusers)

Create user and trigger activation process.

##### `GET: /api/rainlab/user/users/activate/{code}`

[](#get-apirainlabuserusersactivatecode)

Activate a new user.

##### `POST: /api/rainlab/user/users/forgot-password`

[](#post-apirainlabuserusersforgot-password)

Send the user a link to reset their password.

##### `POST: /api/rainlab/user/users/reset-password`

[](#post-apirainlabuserusersreset-password)

Reset a user's password.

##### `GET: /api/rainlab/user/account`

[](#get-apirainlabuseraccount)

Get information about the authenticated user. This route uses the [`AuthMiddleware`](https://github.com/rainlab/user-plugin/blob/master/classes/AuthMiddleware.php), authentication is required to access it.

##### `POST: /api/rainlab/user/account`

[](#post-apirainlabuseraccount)

Updates information about the authenticated user. This route uses the [`AuthMiddleware`](https://github.com/rainlab/user-plugin/blob/master/classes/AuthMiddleware.php), authentication is required to access it. When changing passwords with safe password updates enabled, the user's current password must be included in the request as `password_current`.

##### `DELETE: /api/rainlab/user/account/avatar`

[](#delete-apirainlabuseraccountavatar)

Deletes the authenticated user's avatar. This route uses the [`AuthMiddleware`](https://github.com/rainlab/user-plugin/blob/master/classes/AuthMiddleware.php), authentication is required to access it.

License
-------

[](#license)

[MIT](https://github.com/scottbedard/rainlab-user-api/blob/master/LICENSE)

Copyright (c) 2018-present, Scott Bedard.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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 ~166 days

Total

3

Last Release

2409d ago

Major Versions

0.2.0 → 1.0.02019-11-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/904cc72c102eb3725fdc5191aaf7519724839af6feb847dc20dfa138f37e50b2?d=identicon)[scottbedard](/maintainers/scottbedard)

---

Top Contributors

[![scottbedard](https://avatars.githubusercontent.com/u/7980426?v=4)](https://github.com/scottbedard "scottbedard (144 commits)")

---

Tags

octobercmsvuevuetober

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vuetober-rainlab-user-api/health.svg)

```
[![Health](https://phpackages.com/badges/vuetober-rainlab-user-api/health.svg)](https://phpackages.com/packages/vuetober-rainlab-user-api)
```

###  Alternatives

[kartik-v/yii2-password

Useful password strength validation utilities for Yii Framework 2.0

761.2M17](/packages/kartik-v-yii2-password)

PHPackages © 2026

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