PHPackages                             kinde-oss/kinde-auth-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. kinde-oss/kinde-auth-php

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

kinde-oss/kinde-auth-php
========================

Kinde PHP SDK for authentication

2.4.0(2mo ago)2369.5k—8%14[4 issues](https://github.com/kinde-oss/kinde-auth-php/issues)[10 PRs](https://github.com/kinde-oss/kinde-auth-php/pulls)3MITPHPPHP ^7.4 || ^8.0

Since Nov 2Pushed 1mo ago8 watchersCompare

[ Source](https://github.com/kinde-oss/kinde-auth-php)[ Packagist](https://packagist.org/packages/kinde-oss/kinde-auth-php)[ Docs](https://kinde.com)[ RSS](/packages/kinde-oss-kinde-auth-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (10)Versions (54)Used By (3)

Kinde PHP SDK
=============

[](#kinde-php-sdk)

The official PHP SDK for Kinde authentication and management APIs.

Overview
--------

[](#overview)

The Kinde PHP SDK provides two main clients:

1. **KindeClientSDK** - For OAuth user authentication (frontend applications)
2. **KindeManagementClient** - For server-to-server management operations (backend services)

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

[](#installation)

```
composer require kinde-oss/kinde-php-sdk
```

Quick Start
-----------

[](#quick-start)

### Environment Variables

[](#environment-variables)

Set up your environment variables:

```
# Required for both clients
KINDE_DOMAIN=https://your-domain.kinde.com
KINDE_CLIENT_ID=your_client_id
KINDE_CLIENT_SECRET=your_client_secret

# OAuth client specific
KINDE_REDIRECT_URI=http://localhost:8000/auth/callback
KINDE_LOGOUT_REDIRECT_URI=http://localhost:8000
KINDE_GRANT_TYPE=authorization_code

# Management client specific (optional)
KINDE_MANAGEMENT_ACCESS_TOKEN=your_access_token
```

### OAuth Client (User Authentication)

[](#oauth-client-user-authentication)

```
use Kinde\KindeSDK\KindeClientSDK;

// Create OAuth client from environment variables (recommended)
$kindeClient = KindeClientSDK::createFromEnv();

// Or use constructor (same result)
$kindeClient = new KindeClientSDK();

// Or override specific parameters
$kindeClient = new KindeClientSDK(
    domain: 'https://custom-domain.kinde.com', // Override domain
    redirectUri: null, // Use from environment
    clientId: null, // Use from environment
    clientSecret: null, // Use from environment
    grantType: 'authorization_code' // Override grant type
);

// Redirect user to login
$kindeClient->login();

// Handle callback and get user info
if ($kindeClient->isAuthenticated) {
    $user = $kindeClient->getUserDetails();
    echo "Welcome, {$user['given_name']}!";

    // Check user entitlements
    if ($kindeClient->hasEntitlement('premium_features')) {
        $limit = $kindeClient->getEntitlementLimit('premium_features');
        echo "You have premium features with limit: " . $limit;
    }
}
```

### Management Client (Server-to-Server)

[](#management-client-server-to-server)

```
use Kinde\KindeSDK\KindeManagementClient;

// Create management client from environment variables (recommended)
$management = KindeManagementClient::createFromEnv();

// Or use constructor (same result)
$management = new KindeManagementClient();

// Or override specific parameters
$management = new KindeManagementClient(
    domain: 'https://custom-domain.kinde.com', // Override domain
    clientId: null, // Use from environment
    clientSecret: null, // Use from environment
    accessToken: 'custom_token' // Override access token
);

// Create a user
$user = $management->users->createUser([
    'given_name' => 'John',
    'family_name' => 'Doe',
    'email' => 'john@example.com'
]);

// Get all users
$users = $management->users->getUsers();

// Create an organization
$org = $management->organizations->createOrganization([
    'name' => 'My Organization'
]);
```

Framework Integration
---------------------

[](#framework-integration)

### Laravel

[](#laravel)

```
composer require kinde-oss/kinde-auth-php
```

**Register the service provider in `config/app.php`:**

```
'providers' => [
    // ... other providers
    Kinde\KindeSDK\Frameworks\Laravel\KindeServiceProvider::class,
],
```

**Publish the configuration:**

```
php artisan vendor:publish --tag=kinde-config
```

> **Security Note**: Environment variables are only accessible to server-side code (controllers, services, etc.) and are not available to client-side code or public assets. This ensures that sensitive configuration like `KINDE_CLIENT_SECRET` remains secure and is never exposed to the browser.

```
// In your controller
use Kinde\KindeSDK\KindeClientSDK;
use Kinde\KindeSDK\KindeManagementClient;

class AuthController extends Controller
{
    public function __construct(
        private KindeClientSDK $kindeClient,
        private KindeManagementClient $management
    ) {}

    public function login()
    {
        return $this->kindeClient->login();
    }

    public function createUser(Request $request)
    {
        $user = $this->management->users->createUser([
            'given_name' => $request->input('given_name'),
            'family_name' => $request->input('family_name'),
            'email' => $request->input('email')
        ]);

        return response()->json($user);
    }
}
```

Available APIs
--------------

[](#available-apis)

### Management Client APIs

[](#management-client-apis)

The `KindeManagementClient` provides access to all management APIs:

- **Users API** - `$management->users`
- **Organizations API** - `$management->organizations`
- **Applications API** - `$management->applications`
- **Roles API** - `$management->roles`
- **Permissions API** - `$management->permissions`
- **Feature Flags API** - `$management->featureFlags`
- **Environments API** - `$management->environments`
- **OAuth API** - `$management->oauth`
- **And many more...**

### OAuth Client Features

[](#oauth-client-features)

The `KindeClientSDK` provides OAuth authentication features:

- User login/logout
- Authorization code flow
- PKCE flow
- User profile access
- Token management
- Portal redirects
- **Entitlements** - Access user billing entitlements and feature limits

Documentation
-------------

[](#documentation)

- [Management Client Documentation](MANAGEMENT_CLIENT.md)
- [Entitlements Documentation](docs/ENTITLEMENTS.md)
- [Framework Integration](FRAMEWORK_INTEGRATION.md)
- [Framework Examples](FRAMEWORK_EXAMPLES.md)
- [Portal Integration](PORTAL_INTEGRATION.md)
- [Inertia.js Integration](INERTIA_INTEGRATION.md)

Examples
--------

[](#examples)

See the [playground](playground/) directory for complete working examples.

Migration Guide
---------------

[](#migration-guide)

If you're currently using the API classes directly, you can migrate to the management client:

### Before

[](#before)

```
use Kinde\KindeSDK\Api\UsersApi;
use Kinde\KindeSDK\Configuration;

$config = new Configuration();
$config->setHost('https://your-domain.kinde.com');
$config->setAccessToken('your_token');

$usersApi = new UsersApi(null, $config);
$users = $usersApi->getUsers();
```

### After

[](#after)

```
use Kinde\KindeSDK\KindeManagementClient;

$management = KindeManagementClient::createFromEnv();
$users = $management->users->getUsers();
```

Support
-------

[](#support)

- [Documentation](https://docs.kinde.com)
- [API Reference](https://docs.kinde.com/kinde-apis/)

License
-------

[](#license)

This project is licensed under the MIT License.

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance85

Actively maintained with recent releases

Popularity43

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor3

3 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 ~75 days

Recently: every ~50 days

Total

17

Last Release

81d ago

Major Versions

0.0.3 → 1.2.02023-05-29

1.2.5 → 2.0.02024-11-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/7afe6f6875cadc1ca7ec18a3823e7922d3f71fd7a47c32761b3f0e3bd1ff1b46?d=identicon)[kinde\_engineering](/maintainers/kinde_engineering)

---

Top Contributors

[![davidkinde](https://avatars.githubusercontent.com/u/107987112?v=4)](https://github.com/davidkinde "davidkinde (43 commits)")[![KeeganBeuthin](https://avatars.githubusercontent.com/u/95130935?v=4)](https://github.com/KeeganBeuthin "KeeganBeuthin (38 commits)")[![trunges21](https://avatars.githubusercontent.com/u/108719432?v=4)](https://github.com/trunges21 "trunges21 (28 commits)")[![Koosha-Owji](https://avatars.githubusercontent.com/u/87961112?v=4)](https://github.com/Koosha-Owji "Koosha-Owji (21 commits)")[![rairaman](https://avatars.githubusercontent.com/u/38846786?v=4)](https://github.com/rairaman "rairaman (13 commits)")[![brettchaldecott](https://avatars.githubusercontent.com/u/216964?v=4)](https://github.com/brettchaldecott "brettchaldecott (11 commits)")[![DanielRivers](https://avatars.githubusercontent.com/u/1270799?v=4)](https://github.com/DanielRivers "DanielRivers (9 commits)")[![onderay](https://avatars.githubusercontent.com/u/24711152?v=4)](https://github.com/onderay "onderay (7 commits)")[![0ctan33](https://avatars.githubusercontent.com/u/76810766?v=4)](https://github.com/0ctan33 "0ctan33 (5 commits)")[![oliwolff1](https://avatars.githubusercontent.com/u/28074898?v=4)](https://github.com/oliwolff1 "oliwolff1 (2 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (2 commits)")[![daniel-kinde](https://avatars.githubusercontent.com/u/188374502?v=4)](https://github.com/daniel-kinde "daniel-kinde (1 commits)")[![boxblinkracer](https://avatars.githubusercontent.com/u/5579326?v=4)](https://github.com/boxblinkracer "boxblinkracer (1 commits)")[![Krish0369](https://avatars.githubusercontent.com/u/118180890?v=4)](https://github.com/Krish0369 "Krish0369 (1 commits)")

---

Tags

phpsdkauthAuthenticationkinde

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/kinde-oss-kinde-auth-php/health.svg)

```
[![Health](https://phpackages.com/badges/kinde-oss-kinde-auth-php/health.svg)](https://phpackages.com/packages/kinde-oss-kinde-auth-php)
```

###  Alternatives

[google/auth

Google Auth Library for PHP

1.4k272.7M162](/packages/google-auth)[ellaisys/aws-cognito

AWS Cognito package that allows Auth and other related features using the AWS SDK for PHP

120220.7k1](/packages/ellaisys-aws-cognito)[maicol07/flarum-ext-sso

SSO for Flarum

468.3k](/packages/maicol07-flarum-ext-sso)

PHPackages © 2026

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