PHPackages                             redsnapper/socialite-swissrx - 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. redsnapper/socialite-swissrx

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

redsnapper/socialite-swissrx
============================

A Laravel Socialite provider for Swiss Rx, an authentication system for Swiss healthcare professionals.

V2.0.0(2mo ago)15.2kMITPHPPHP ^8.0|^8.1CI passing

Since Sep 2Pushed 2mo ago4 watchersCompare

[ Source](https://github.com/RedSnapper/socialite-swiss-rx)[ Packagist](https://packagist.org/packages/redsnapper/socialite-swissrx)[ RSS](/packages/redsnapper-socialite-swissrx/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (6)Versions (13)Used By (0)

\#Sociaite/Swiss-Rx

### A Laravel Socialite driver for Swiss RX, an authentication system for Swiss healthcare professionals

[](#a-laravel-socialite-driver-for-swiss-rx-an-authentication-system-for-swiss-healthcare-professionals)

[![Latest Version on Packagist](https://camo.githubusercontent.com/38e43fb2bacbf3760cb2b81e01caaebb2d9376a931391f556546a22ac680c166/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76656e646f725f736c75672f7061636b6167655f736c75672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/redsnapper/socialite-swissrx)[![GitHub Tests Action Status](https://github.com/redsnapper/socialite-swiss-rx/workflows/run-tests/badge.svg)](https://github.com/redsnapper/socialite-swiss-rx/actions)[![Total Downloads](https://camo.githubusercontent.com/5ff2d481b100b875feb7c3d032f7150589315206a66367e88a121931dac8a2c6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726564736e61707065722f736f6369616c6974652d737769737372782e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/redsnapper/socialite-swissrx)

---

This repo can be used to provide OAuth authentication with \[Swiss Rx\] ().

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

[](#installation)

You can install the package via composer:

```
composer require redsnapper/socialite-swissrx
```

Add event listener mapping in your `EventServiceProvider.php`

```
//Providers\EventServiceProvider.php

use RedSnapper\SwissRx\SwissRxExtendSocialite;
use SocialiteProviders\Manager\SocialiteWasCalled;

protected $listen = [
        //...
        SocialiteWasCalled::class => [
            SwissRXExtendSocialite::class
        ],
    ];
```

Then go to your services.php and add swissrx credentials. When using your callback, **make sure it's registered with swiss-rx first**.

```
//config\services.php

//...
'swissrx' => [
    'client_id' => env('SWISS_RX_KEY'),
    'client_secret' => env('SWISS_RX_SECRET'),
    'redirect' => config('app.url') . "/swiss-rx/callback",
    'token_leeway'  => env('SWISS_RX_TOKEN_LEEWAY'), // optional - you can use this if you are getting 'Cannot handle token prior to...' exceptions
],
```

And finally add your Swiss-Rx key and secret to the `.env` file:

```
SWISS_RX_KEY=
SWISS_RX_SECRET=
```

Usage
-----

[](#usage)

Register your routes

```
//web.php

Route::get('/swiss-rx/login', [LoginController::class, 'redirectToProvider'])->name('login');
Route::get('/swiss-rx/callback', [LoginController::class, 'handleProviderCallback'])->name('login.callback');
```

Then in your controller call the `redirectToProvider()` and `handleProviderCallback()`:

```
//Http\Controllers\LoginController.php

use Laravel\Socialite\Facades\Socialite;

public function redirectToProvider()
{
    return Socialite::driver('swissrx')->with([
        'lang' => request()->get('lang', 'en')
    ])->redirect();
}

public function handleProviderCallback()
{
    $swissRxUser = Socialite::driver('swissrx')->user();

    retunr $swissRxUser;
}
```

### Scopes

[](#scopes)

By default the `anonymous` scope is used, which will not return any user data other than their ID. To retrieve user data use the socialite method `setScopes()` to request the `personal` scope:

```
public function redirectToProvider()
{
    return Socialite::driver('swissrx')->with([
        'lang' => request()->get('lang', 'en')
    ])
    ->setScopes(['personal'])
    ->redirect();
}
```

Secret key requirements
-----------------------

[](#secret-key-requirements)

As of v2.0, `firebase/php-jwt` has been upgraded to v7 to address CVE-2025-45769 (weak encryption). This version enforces a minimum key length of 32 bytes for HS256 signatures.

Older 9-character secrets previously provided by Swiss RX are **no longer supported**. If you are still using a short secret, you will need to request a new one from Swiss RX.

Testing
-------

[](#testing)

```
vendor/bin/phpunit
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](https://github.com/RedSnapper/socialite-swiss-rx/blob/main/CHANGELOG.MD) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/RedSnapper/socialite-swiss-rx/blob/main/.github/workflows/CONTRIBUTING.MD) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/RedSnapper/socialite-swiss-rx/blob/main/LICENCE.MD) for more information.

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance85

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 71.4% 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 ~163 days

Recently: every ~269 days

Total

11

Last Release

80d ago

Major Versions

v1.2.1 → V2.0.02026-02-19

PHP version history (2 changes)v1.0.0PHP ^7.4|^8.0

v1.0.6PHP ^8.0|^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1785064?v=4)[Mr Ben Griffin](/maintainers/MrBenGriffin)[@MrBenGriffin](https://github.com/MrBenGriffin)

![](https://avatars.githubusercontent.com/u/6851104?v=4)[rstechnical](/maintainers/rstechnical)[@rstechnical](https://github.com/rstechnical)

---

Top Contributors

[![joeuk89](https://avatars.githubusercontent.com/u/6736852?v=4)](https://github.com/joeuk89 "joeuk89 (20 commits)")[![cammackmatthew](https://avatars.githubusercontent.com/u/10643740?v=4)](https://github.com/cammackmatthew "cammackmatthew (3 commits)")[![paramdhal](https://avatars.githubusercontent.com/u/1278858?v=4)](https://github.com/paramdhal "paramdhal (3 commits)")[![pazitron1](https://avatars.githubusercontent.com/u/24591690?v=4)](https://github.com/pazitron1 "pazitron1 (2 commits)")

---

Tags

laravellaravel-packageoauth2socialite-providersswiss-rx

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/redsnapper-socialite-swissrx/health.svg)

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

###  Alternatives

[google/auth

Google Auth Library for PHP

1.4k272.7M161](/packages/google-auth)[thenetworg/oauth2-azure

Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2509.6M48](/packages/thenetworg-oauth2-azure)[socialiteproviders/microsoft

Microsoft OAuth2 Provider for Laravel Socialite

326.1M13](/packages/socialiteproviders-microsoft)[stevenmaguire/oauth2-keycloak

Keycloak OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[robsontenorio/laravel-keycloak-guard

🔑 Simple Keycloak Guard for Laravel

5161.1M3](/packages/robsontenorio-laravel-keycloak-guard)[patrickbussmann/oauth2-apple

Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1132.5M6](/packages/patrickbussmann-oauth2-apple)

PHPackages © 2026

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