PHPackages                             silverstripedev/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. silverstripedev/silverstripe-apikey

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

silverstripedev/silverstripe-apikey
===================================

API Key management for Silverstripe CMS

02PHP

Since Apr 28Pushed 1y agoCompare

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

READMEChangelogDependenciesVersions (1)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

16

—

LowBetter than 5% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor4

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

### Community

Maintainers

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

---

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)")[![BrookeNZ](https://avatars.githubusercontent.com/u/4251008?v=4)](https://github.com/BrookeNZ "BrookeNZ (3 commits)")[![robbieaverill](https://avatars.githubusercontent.com/u/5170590?v=4)](https://github.com/robbieaverill "robbieaverill (3 commits)")[![taicait](https://avatars.githubusercontent.com/u/648750?v=4)](https://github.com/taicait "taicait (3 commits)")[![helpfulrobot](https://avatars.githubusercontent.com/u/15896982?v=4)](https://github.com/helpfulrobot "helpfulrobot (3 commits)")[![chillu](https://avatars.githubusercontent.com/u/111025?v=4)](https://github.com/chillu "chillu (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/silverstripedev-silverstripe-apikey/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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