PHPackages                             helthe/security-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. helthe/security-api

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

helthe/security-api
===================

Helthe API Security Component

1.0.0(12y ago)0681MITPHPPHP &gt;=5.3.3

Since Feb 21Pushed 12y ago1 watchersCompare

[ Source](https://github.com/helthe/ApiSecurity)[ Packagist](https://packagist.org/packages/helthe/security-api)[ Docs](https://helthe.co)[ RSS](/packages/helthe-security-api/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

Helthe API Security [![Build Status](https://camo.githubusercontent.com/578905f9ad4837377c4adc3adef12340b8fbba9b594374a5bd62f1a1a66a9d19/68747470733a2f2f7472617669732d63692e6f72672f68656c7468652f41706953656375726974792e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/helthe/ApiSecurity) [![Scrutinizer Quality Score](https://camo.githubusercontent.com/f808b5c55b515376f290b7be1c854a6c89da2716b03bd0eddfd5984924753076/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f68656c7468652f41706953656375726974792f6261646765732f7175616c6974792d73636f72652e706e673f733d61656264613566323665363764383466613030613437303762363335613639653365343038616335)](https://scrutinizer-ci.com/g/helthe/ApiSecurity/)
======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#helthe-api-security--)

Helthe API Security is a library for doing API key authentication with the Symfony [Security Component](http://symfony.com/doc/current/components/security/introduction.html).

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

[](#installation)

### Using Composer

[](#using-composer)

#### Manually

[](#manually)

Add the following in your `composer.json`:

```
{
    "require": {
        // ...
        "helthe/security-api": "~1.0"
    }
}
```

#### Using the command line

[](#using-the-command-line)

```
$ composer require 'helthe/security-api=~1.0'
```

Usage
-----

[](#usage)

### Authentication Provider

[](#authentication-provider)

An API authentication provider implementing `AuthenticationProviderInterface`is supplied supporting the `PreAuthenticatedToken`. Once authenticated, a user will be authenticated using a `ApiKeyAuthenticatedToken` which is an extension of `PreAuthenticatedToken`where the api key is not erased.

#### User Provider

[](#user-provider)

The library provides its own `UserProviderInterface` that must implemented by the user provider supplied to the `ApiKeyAuthenticationProvider`.

#### Example

[](#example)

```
use Helthe\Component\Security\Api\Authentication\Provider\ApiKeyAuthenticationProvider;
use Symfony\Component\Security\Core\User\UserChecker;

// Helthe\Component\Security\Api\User\UserProviderInterface
$userProvider = new InMemoryUserProvider(
    array(
        'admin' => array(
            'api_key' => 'foo',
        ),
    )
);

// for some extra checks: is account enabled, locked, expired, etc.?
$userChecker = new UserChecker();

$provider = new ApiKeyAuthenticationProvider(
    $userProvider,
    $userChecker,
    'your_api',
);

$provider->authenticate($unauthenticatedToken);
```

### Firewall

[](#firewall)

Two firewall listeners are available extending `AbstractPreAuthenticatedListener`. `HttpHeaderListener` checks for the api key in the `Request` headers and `QueryStringListener`checks in the `Request` query string.

Bugs
----

[](#bugs)

For bugs or feature requests, please [create an issue](https://github.com/helthe/ApiSecurity/issues/new).

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

4513d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

apisecurityAuthenticationapi-securityapikey

### Embed Badge

![Health badge](/badges/helthe-security-api/health.svg)

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

###  Alternatives

[scheb/2fa

Two-factor authentication for Symfony applications (please use scheb/2fa-bundle to install)

585684.2k1](/packages/scheb-2fa)[remotemerge/totp-php

Lightweight, fast, and secure TOTP (2FA) authentication library for PHP — battle tested, dependency free, and ready for enterprise integration.

2118.5k](/packages/remotemerge-totp-php)

PHPackages © 2026

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