PHPackages                             authrocket/authrocket - 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. authrocket/authrocket

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

authrocket/authrocket
=====================

AuthRocket PHP library

2.4.0(3y ago)12.0kMITPHPPHP &gt;=7CI failing

Since Jul 23Pushed 3y ago1 watchersCompare

[ Source](https://github.com/authrocket/authrocket-php)[ Packagist](https://packagist.org/packages/authrocket/authrocket)[ Docs](https://authrocket.com/)[ RSS](/packages/authrocket-authrocket/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (3)Versions (15)Used By (0)

AuthRocket
==========

[](#authrocket)

[AuthRocket](https://authrocket.com/) provides Auth as a Service, making it quick and easy to add signups, logins, social auth, a full user management UI, and much more to your app.

The `authrocket` PHP library covers all of our Core API. It also covers select portions of the Configuration API.

Installation
------------

[](#installation)

The library is designed to be installed using `composer`. It should also be usable using any other method typically supported by composer-compatible packages.

For installation, run:

```
composer require authrocket/authrocket

# alternate:
php composer.phar require authrocket/authrocket
```

Or, add `"authrocket/authrocket": "^2"` to the `require` section of your composer.json and run `composer install`.

You can also download `authrocket.phar`, a .zip, or a .tar.gz of the latest release directly from GitHub:

Client Basics
-------------

[](#client-basics)

### Using environment variables

[](#using-environment-variables)

If you are using environment variables to manage external services like AuthRocket, then it's very easy to initialize the AuthRocket client:

```
$client = \AuthRocket\AuthRocket::autoConfigure();
```

Ensure these environment variables are set:

```
# If only validating tokens
LOGINROCKET_URL    = https://SAMPLE.e2.loginrocket.com/

# If only validating tokens and default JWT key type has been changed to HS256
LOGINROCKET_URL    = https://SAMPLE.e2.loginrocket.com/
AUTHROCKET_JWT_KEY = SAMPLE

# To use the AuthRocket API
AUTHROCKET_API_KEY = ks_SAMPLE
AUTHROCKET_URL     = https://api-e2.authrocket.com/v2
AUTHROCKET_REALM   = rl_SAMPLE  # optional, but recommended (see below)
# plus LOGINROCKET_URL and/or AUTHROCKET_JWT_KEY if also validating tokens
```

`AUTHROCKET_API_KEY = ks_SAMPLE`Your AuthRocket API key. Required to use the API (but not if only performing JWT verification of login tokens).

`AUTHROCKET_JWT_KEY = SAMPLE`Used to perform JWT signing verification of login tokens. Not required if validating all tokens using the API instead. Also not required if LOGINROCKET\_URL is set and RS256 keys are being used, as public keys will be auto-retrieved. This is a realm-specific value, so like `AUTHROCKET_REALM`, set it directly if using multiple realms (see below).

`AUTHROCKET_REALM = rl_SAMPLE`Sets an application-wide default realm ID. If you're using a single realm, this is definitely easiest. Certain multi-tenant apps might use multiple realms. In this case, don't set this globally, but directly when constructing the client (see below).

`AUTHROCKET_URL = https://api-e2.authrocket.com/v2`The URL of the AuthRocket API server. This may vary depending on which cluster your service is provisioned on.

`LOGINROCKET_URL = https://SAMPLE.e2.loginrocket.com/`The LoginRocket URL for your Connected App. Used for auto-retrieval of RS256 JWT keys (if AUTHROCKET\_JWT\_KEY is not set). If your app uses multiple realms, you may need to set this directly instead (see below). If you're using a custom domain, this will be that domain and will not contain 'loginrocket.com'.

If you are using multiple realms, we recommend building a new client for each realm, directly setting `realm`, `jwtKey`, and/or `loginrocketUrl`:

```
$client = \AuthRocket\AuthRocket::autoConfigure([
  'realm'          => 'rl_SAMPLE',
  'jwtKey'         => 'SAMPLE',
  'loginrocketUrl' => 'https://SAMPLE.e2.loginrocket.com/'
]);
```

Similarly, if changing locales between requests, build a new client for each:

```
$client = \AuthRocket\AuthRocket::autoConfigure([
  'locale' => 'es'
]);
```

### Direct configuration

[](#direct-configuration)

It's also possible to configure the AuthRocket client instance directly:

```
$client = new \AuthRocket\AuthRocket([
  'apiKey'         => 'ks_SAMPLE',
  'url'            => 'https://api-e2.authrocket.com/v2',
  'realm'          => 'rl_SAMPLE',
  'jwtKey'         => 'SAMPLE',
  'loginrocketUrl' => 'https://SAMPLE.e2.loginrocket.com/',
  'locale'         => 'en'
]);
```

Usage
-----

[](#usage)

Documentation is provided on our site:

- [PHP Integration Guide](https://authrocket.com/docs/integration/php)
- [PHP SDK Docs](https://authrocket.com/docs/sdks/php) (Expands on this README)
- [API Docs with PHP examples](https://authrocket.com/docs/api#core-api)

Contributing
------------

[](#contributing)

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

License
-------

[](#license)

MIT

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 96.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 ~191 days

Recently: every ~223 days

Total

13

Last Release

1321d ago

Major Versions

0.9.1 → 1.0.02017-01-07

1.2.0 → 2.0.02020-02-22

1.2.1 → 2.2.02021-05-19

1.3.0 → 2.3.02021-05-24

PHP version history (2 changes)0.9.0PHP &gt;=5.5

2.0.0PHP &gt;=7

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e0fc4a7e28c4e8fb70c5f7d17667a139ccef7cd527ddaaf8f40f12d8ed4415c?d=identicon)[notioneer](/maintainers/notioneer)

---

Top Contributors

[![zarqman](https://avatars.githubusercontent.com/u/22556?v=4)](https://github.com/zarqman "zarqman (30 commits)")[![fkollmann](https://avatars.githubusercontent.com/u/106287?v=4)](https://github.com/fkollmann "fkollmann (1 commits)")

---

Tags

authrocketphpphp-libraryapiauthauthrocket

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/authrocket-authrocket/health.svg)

```
[![Health](https://phpackages.com/badges/authrocket-authrocket/health.svg)](https://phpackages.com/packages/authrocket-authrocket)
```

###  Alternatives

[google/auth

Google Auth Library for PHP

1.4k286.7M205](/packages/google-auth)[ellaisys/aws-cognito

AWS Cognito package that allows Auth and other related features using the AWS SDK for PHP

121242.9k1](/packages/ellaisys-aws-cognito)[xeroapi/xero-php-oauth2

Xero official PHP SDK for oAuth2 generated with OpenAPI spec 3

1054.6M18](/packages/xeroapi-xero-php-oauth2)[kinde-oss/kinde-auth-php

Kinde PHP SDK for authentication

2280.2k3](/packages/kinde-oss-kinde-auth-php)[benbjurstrom/cognito-jwt-guard

A laravel auth guard for JSON Web Tokens issued by Amazon AWS Cognito

1113.1k](/packages/benbjurstrom-cognito-jwt-guard)[casdoor/casdoor-php-sdk

PHP client SDK for Casdoor

2319.8k](/packages/casdoor-casdoor-php-sdk)

PHPackages © 2026

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