PHPackages                             vanilla/js-connect-php - 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. vanilla/js-connect-php

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

vanilla/js-connect-php
======================

Client library for Vanilla's jsConnect SSO system.

v4.0.1(3y ago)37438.3k↓30.3%271MITPHPPHP &gt;=7.4CI failing

Since Apr 3Pushed 3y ago21 watchersCompare

[ Source](https://github.com/vanilla/jsConnectPHP)[ Packagist](https://packagist.org/packages/vanilla/js-connect-php)[ RSS](/packages/vanilla-js-connect-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (6)Versions (10)Used By (1)

Vanilla jsConnect Client Library for PHP
========================================

[](#vanilla-jsconnect-client-library-for-php)

***Note:** Vanilla has recently updated it's jsConnect protocol to a different architecture that will work with current browsers that block third party cookies. Make sure you update your libraries to use the protocol. Once you've done this you will need to configure Vanilla to use the protocol in your dashboard under jsConnect settings.*

About jsConnect
---------------

[](#about-jsconnect)

The jsConnect protocol is a simple single sign on (SSO) framework that allows you to easily use your own site to sign on to a Vanilla site. It is intended to require as little programming as possible. You will need to do the following:

1. Program one page that responds with information about the currently signed in user.
2. Your main sign in page should be capable of redirecting to a URL that is supplied in the querystring.
3. You can optionally provide a registration page too, but it must also be capable of redirecting via a query string parameter.

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

[](#installation)

There are two ways to install jsConnect.

1. You can install this library via composer. You want to require `vanilla/js-connect-php`.
2. You can use the supplied [functions.jsconnect.php](./dist/functions.jsconnect.php). This is the old way of installing Vanilla. It still works, but we recommend transitioning to the composer install.

Usage
-----

[](#usage)

There are two ways to use this jsConnect library. There is an object oriented way and a functional way.

### Object Oriented Usage

[](#object-oriented-usage)

If you are new to jsConnect then we recommend the object oriented usage. Here is an example of what your page might look like.

```
$jsConnect = new \Vanilla\JsConnect\JsConnect();

// 1. Add your client ID and secret. These values are defined in your dashboard.
$jsConnect->setSigningCredentials($clientID, $secret);

// 2. Grab the current user from your session management system or database here.
$signedIn = true; // this is just a placeholder

// YOUR CODE HERE.

// 3. Fill in the user information in a way that Vanilla can understand.
if ($signedIn) {
    // CHANGE THESE FOUR LINES.
  	$jsConnect
        ->setUniqueID('123')
      	->setName('Username')
      	->setEmail('user@example.com')
      	->setPhotoUrl('https://example.com/avatar.jpg');
} else {
  $jsConnect->setGuest(true);
}

// 4. Generate the jsConnect response and redirect.
$jsConnect->handleRequest($_GET);
```

Functional Usage
----------------

[](#functional-usage)

The functional usage is mainly for backwards compatibility. If you are currently using this method then you can continue to do so. However, you may want to port your code to the object oriented method when you have time.

Here is an example of the functional usage:

```
// 1. Get your client ID and secret here. These must match those in your jsConnect settings.
$clientID = "1234";
$secret = "1234";

// 2. Grab the current user from your session management system or database here.
$signedIn = true; // this is just a placeholder

// YOUR CODE HERE.

// 3. Fill in the user information in a way that Vanilla can understand.
$user = array();

if ($signedIn) {
    // CHANGE THESE FOUR LINES.
    $user['uniqueid'] = '123';
    $user['name'] = 'John PHP';
    $user['email'] = 'john.php@example.com';
    $user['photourl'] = '';
}

// 4. Generate the jsConnect string.

// This should be true unless you are testing.
// You can also use a hash name like md5, sha1 etc which must be the name as the connection settings in Vanilla.
$secure = true;
writeJsConnect($user, $_GET, $clientID, $secret, $secure);
```

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity48

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor2

2 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 ~155 days

Recently: every ~254 days

Total

8

Last Release

1148d ago

Major Versions

v3.2.2 → v4.0.02023-03-24

PHP version history (3 changes)v3.0PHP &gt;=7.1.0

v4.0.0PHP &gt;=8.0

v4.0.1PHP &gt;=7.4

### Community

Maintainers

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

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

---

Top Contributors

[![tburry](https://avatars.githubusercontent.com/u/97432?v=4)](https://github.com/tburry "tburry (49 commits)")[![DaazKu](https://avatars.githubusercontent.com/u/2412909?v=4)](https://github.com/DaazKu "DaazKu (22 commits)")[![thundrax](https://avatars.githubusercontent.com/u/75855003?v=4)](https://github.com/thundrax "thundrax (10 commits)")[![linc](https://avatars.githubusercontent.com/u/117672?v=4)](https://github.com/linc "linc (7 commits)")[![initvector](https://avatars.githubusercontent.com/u/1390241?v=4)](https://github.com/initvector "initvector (6 commits)")[![charrondev](https://avatars.githubusercontent.com/u/1770056?v=4)](https://github.com/charrondev "charrondev (2 commits)")[![cchabilall83](https://avatars.githubusercontent.com/u/36996270?v=4)](https://github.com/cchabilall83 "cchabilall83 (1 commits)")[![maximgeerinck](https://avatars.githubusercontent.com/u/615509?v=4)](https://github.com/maximgeerinck "maximgeerinck (1 commits)")[![nervoustwit](https://avatars.githubusercontent.com/u/2651070?v=4)](https://github.com/nervoustwit "nervoustwit (1 commits)")[![gpapin](https://avatars.githubusercontent.com/u/3064311?v=4)](https://github.com/gpapin "gpapin (1 commits)")

---

Tags

production

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/vanilla-js-connect-php/health.svg)

```
[![Health](https://phpackages.com/badges/vanilla-js-connect-php/health.svg)](https://phpackages.com/packages/vanilla-js-connect-php)
```

###  Alternatives

[google/auth

Google Auth Library for PHP

1.4k272.7M162](/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)[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)[wp-graphql/wp-graphql-jwt-authentication

JWT Authentication for WPGraphQL

361118.4k1](/packages/wp-graphql-wp-graphql-jwt-authentication)

PHPackages © 2026

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