PHPackages                             sminnee/silverstripe-apikey - 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. [API Development](/categories/api)
4. /
5. sminnee/silverstripe-apikey

ActiveSilverstripe-vendormodule[API Development](/categories/api)

sminnee/silverstripe-apikey
===========================

API Key management for Silverstripe CMS

0.0.2(10y ago)63.6k19[2 issues](https://github.com/sminnee/silverstripe-apikey/issues)BSD-3-ClausePHP

Since Dec 3Pushed 1y ago6 watchersCompare

[ Source](https://github.com/sminnee/silverstripe-apikey)[ Packagist](https://packagist.org/packages/sminnee/silverstripe-apikey)[ RSS](/packages/sminnee-silverstripe-apikey/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (1)Versions (9)Used By (0)

SilverStripe API Key
====================

[](#silverstripe-api-key)

[![Build Status](https://camo.githubusercontent.com/a8ced9cb039f3596d604efa179a98ba5dd564c05b54c5e3df5e8c01563117ff7/68747470733a2f2f7472617669732d63692e6f72672f736d696e6e65652f73696c7665727374726970652d6170696b65792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/sminnee/silverstripe-apikey)[![codecov](https://camo.githubusercontent.com/3f5ac6e1f24d2e722fef114ad7bc113464365e6f0c09506a335ac14ccb05394c/68747470733a2f2f636f6465636f762e696f2f67682f736d696e6e65652f73696c7665727374726970652d6170696b65792f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/sminnee/silverstripe-apikey)

This module provides a way of creating an managing API keys within SilverStripe. This can be useful for building RESTful and other APIs.

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

[](#requirements)

- SilverStripe ^4 || ^5
- PHP 5.5+

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

[](#installation)

```
composer require sminnee/silverstripe-apikey

```

How it works
------------

[](#how-it-works)

- Extensions the the `SecurityAdmin` provide interfaces for seeing API keys, and generating new ones. API keys are allocated member-by-member.
- A `RequestMiddleware` will look for an API key header (default: `X-API-Key`) and if it is present, authenticate the user so that Member::currentUser() will return the corresponding member. This should be configured by non-GraphQL requests.
- A `ApiKeyAuthenticator` should be configured for [GraphQL](https://github.com/silverstripe/silverstripe-graphql)request and will return the authenticated member for GraphQL contexts to use, while not applying it to the CMS session.

Regular use
-----------

[](#regular-use)

For regular module usage, use the `RequestMiddleware` class. The configuration to apply it is in this module's `apikey.yml`, but is commented out.

Copy the configuration and add it to your `mysite/_config/apikey.yml` file.

This will protect all of your frontend routes.

GraphQL
-------

[](#graphql)

The GraphQL authenticator will work separately from the `RequestMiddleware`. If using this module for GraphQL, you will probably want to disable the `RequestMiddleware`. If you run both at the same time you will find that:

- Authentication exceptions are thrown outside of the GraphQL context (i.e. not wrapped in JSON output)
- Successful requests will register two "times used" each, since it's authenticated in two places

Limitations
-----------

[](#limitations)

- You can't limit the rights that the API key has to be more granular than "all rights of the given user".
- Keys can't be disabled, only deleted
- No support for storing encrypted ("read-once") keys

Status
------

[](#status)

This should be considered experimental for now, and used with care. It has not received a security audit.

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance23

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor3

3 contributors hold 50%+ of commits

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

Recently: every ~604 days

Total

7

Last Release

1393d ago

Major Versions

0.1.x-dev → 1.0.0-beta12018-07-24

### Community

Maintainers

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

---

Top Contributors

[![blueo](https://avatars.githubusercontent.com/u/948122?v=4)](https://github.com/blueo "blueo (7 commits)")[![matt-in-a-hat](https://avatars.githubusercontent.com/u/1852796?v=4)](https://github.com/matt-in-a-hat "matt-in-a-hat (5 commits)")[![robbieaverill](https://avatars.githubusercontent.com/u/5170590?v=4)](https://github.com/robbieaverill "robbieaverill (3 commits)")[![BrookeNZ](https://avatars.githubusercontent.com/u/4251008?v=4)](https://github.com/BrookeNZ "BrookeNZ (3 commits)")[![chillu](https://avatars.githubusercontent.com/u/111025?v=4)](https://github.com/chillu "chillu (3 commits)")[![helpfulrobot](https://avatars.githubusercontent.com/u/15896982?v=4)](https://github.com/helpfulrobot "helpfulrobot (3 commits)")[![sminnee](https://avatars.githubusercontent.com/u/59968?v=4)](https://github.com/sminnee "sminnee (2 commits)")[![xini](https://avatars.githubusercontent.com/u/1152403?v=4)](https://github.com/xini "xini (1 commits)")[![jesscostello](https://avatars.githubusercontent.com/u/33467471?v=4)](https://github.com/jesscostello "jesscostello (1 commits)")[![mfendeksilverstripe](https://avatars.githubusercontent.com/u/26395487?v=4)](https://github.com/mfendeksilverstripe "mfendeksilverstripe (1 commits)")[![ScopeyNZ](https://avatars.githubusercontent.com/u/3260989?v=4)](https://github.com/ScopeyNZ "ScopeyNZ (1 commits)")

### Embed Badge

![Health badge](/badges/sminnee-silverstripe-apikey/health.svg)

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

###  Alternatives

[silverstripe/graphql

GraphQL server for SilverStripe models and other data

512.4M21](/packages/silverstripe-graphql)

PHPackages © 2026

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