PHPackages                             rafalniewinski/silex-steamauth - 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. rafalniewinski/silex-steamauth

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

rafalniewinski/silex-steamauth
==============================

Steam Community authorizaion provider for Silex with SecurityServiceProvider

v2.0.0(10y ago)237MITPHPPHP &gt;=5.5.0

Since Jun 7Pushed 10y ago1 watchersCompare

[ Source](https://github.com/RafalNiewinski/Silex-SteamAuth)[ Packagist](https://packagist.org/packages/rafalniewinski/silex-steamauth)[ Docs](https://github.com/RafalNiewinski/Silex-SteamAuth)[ RSS](/packages/rafalniewinski-silex-steamauth/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

##### This version is for Silex ~2.0

[](#this-version-is-for-silex-20)

###### (version for Silex ~1.3 is available in another branch)

[](#version-for-silex-13-is-available-in-another-branch)

Silex-SteamAuth
===============

[](#silex-steamauth)

Steam Community authorizaion provider for Silex PHP framework with SecurityServiceProvider.

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

[](#installation)

If you want to install with Composer:

```
composer require rafalniewinski/silex-steamauth "~2.0"

```

Alternatively, you can clone this repository:

```
git clone https://github.com/RafalNiewinski/Silex-SteamAuth.git

```

\##Usage This library uses a standard SecurityServiceProvider module. Be sure to read the operating instructions for this module:

Using Steam as authorization provider is similar to "Securing a Path with a Form" paragraph except that the form is replaced with a OpenID and Steam Community mechanism.

\###Registering Use this to register your SteamAuthServiceProvider and core SecurityServiceProvider:

```
$app->register(new SteamAuth\SteamAuthServiceProvider(), array(
    'steam_auth.host' => 'https://domain.tld' // your service domain to configure OpenID
));

$app->register(new Silex\Provider\SecurityServiceProvider(), array(
    'admin' => array(
        'pattern' => '^/admin/',
        'steam_auth' => array('check_path' => '/admin/login_check'), // Only this line is different - see below
        'users' => array(
            'admin' => array('ROLE_ADMIN', '5FZ2Z8QIkA7UTZ4BYkoC+GsReLf569mSKDsfods6LYQ8t+a8EW9oaircfMpmaLbPBh4FOBiiFyLfuZmTSUwzZg=='),
        ),
    ),
));
```

If you read carefully you'll notice that the registration of SecurityServiceProvider component is the same as securing using form in original Silex tutorial except for one line **'form' was replaced with 'steam\_auth'**.

'check\_path' option works the same as in the form authorization (must be defined in secured firewall area)

**IMPORTANT**: Login path is permanently set to /login and must be accessible anonymously or be outside firewall

\###Interaction If you want to sign in user, please redirect him to **/login**

If you want to get Steam ID of signed in user, execute:

```
$app['security.token_storage']->getToken()->getUser()->getSteamID();
```

Be careful because if user isn't signed in `getToken()` or `getUser()` can return `null`

\##Defining User Provider Silex-SteamAuth is compatible with standard UserProviderInterface but you must use user SteamID as Username.

Despite compatibility, it is recommended for convenience use a dedicated SteamAuthUserProviderInterface which includes loadUserBySteamId() method.

Here is a SteamAuth edited simple example of a user provider, where Doctrine DBAL is used to store the users:

```
use SteamAuth\SteamAuthUserProviderInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Doctrine\DBAL\Connection;

class UserProvider implements SteamAuthUserProviderInterface
{
    private $conn;

    public function __construct(Connection $conn)
    {
        $this->conn = $conn;
    }

    public function loadUserBySteamId($steamid)
    {
        $stmt = $this->conn->executeQuery('SELECT * FROM users WHERE steamid = ?', array($steamid));

        if (!$user = $stmt->fetch())
        {
            //User never previously logged in from this steam accout - probably you should create new account now
            throw new UsernameNotFoundException(sprintf('steamid "%s" does not exist.', $steamid));
        }

        return new SteamAuthUser($user['steamid'], explode(',', $user['Roles']));
    }

    public function loadUserByUsername($steamid)
    {
        //Retain original method operating for compatibility
        return $this->loadUserBySteamId($steamid);
    }

    public function refreshUser(UserInterface $user)
    {
        if (!$user instanceof SteamAuthUser)
        {
            throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user)));
        }

        return $this->loadUserBySteamId($user->getSteamID());
    }

    public function supportsClass($class)
    {
        return $class === 'SteamAuth\SteamAuthUser';
    }

}
```

**Of course you can extend SteamAuthUser class and expand it freely**

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

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

Total

3

Last Release

3674d ago

Major Versions

v1.0.0 → v2.0.02016-06-07

PHP version history (2 changes)1.0.x-devPHP &gt;=5.3.9

v2.0.0PHP &gt;=5.5.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1041387?v=4)[Rafał Niewiński](/maintainers/RafalNiewinski)[@RafalNiewinski](https://github.com/RafalNiewinski)

---

Top Contributors

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

---

Tags

symfonyauthauthorizationOpenIdsilexsteam

### Embed Badge

![Health badge](/badges/rafalniewinski-silex-steamauth/health.svg)

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

###  Alternatives

[league/oauth2-server

A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.

6.7k143.0M274](/packages/league-oauth2-server)[auth0/auth0-php

PHP SDK for Auth0 Authentication and Management APIs.

40921.3M85](/packages/auth0-auth0-php)[auth0/symfony

Symfony SDK for Auth0 Authentication and Management APIs.

128790.7k](/packages/auth0-symfony)[auth0/login

Auth0 Laravel SDK. Straight-forward and tested methods for implementing authentication, and accessing Auth0's Management API endpoints.

2745.2M3](/packages/auth0-login)[auth0/wordpress

WordPress Plugin for Auth0

18122.7k](/packages/auth0-wordpress)[lorenzoferrarajr/lfj-opauth

LfjOpauth is a Zend Framework 2 module that enables support for many authentication providers through the Opauth framework.

2915.4k](/packages/lorenzoferrarajr-lfj-opauth)

PHPackages © 2026

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