PHPackages                             codebarista/laravel-workos - 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. codebarista/laravel-workos

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

codebarista/laravel-workos
==========================

Authorize Laravel users with WorkOS.

1.2.4(2w ago)089↓100%MITPHPPHP ^8.3

Since Jun 23Pushed 2w agoCompare

[ Source](https://github.com/codebarista/laravel-workos)[ Packagist](https://packagist.org/packages/codebarista/laravel-workos)[ RSS](/packages/codebarista-laravel-workos/feed)WikiDiscussions main Synced today

READMEChangelog (8)Dependencies (5)Versions (7)Used By (0)

Laravel WorkOS
==============

[](#laravel-workos)

### User Roles, Permissions and Stripe Entitlements

[](#user-roles-permissions-and-stripe-entitlements)

Authorize users with WorkOS roles and permissions, as well as subscribed Stripe entitlements. The roles and permissions implementation is heavily inspired by *Spatie Laravel Permission*. The additional Stripe entitlements are applied in the same way as permissions.

1. Installation
---------------

[](#1-installation)

```
 composer require codebarista/laravel-workos
```

2. Configuration
----------------

[](#2-configuration)

### WorkOS

[](#workos)

These variables should match the values provided to you in the WorkOS dashboard for your application:

```
WORKOS_REDIRECT_URL="${APP_URL}/authenticate"
WORKOS_CLIENT_ID=your-client-id
WORKOS_API_KEY=your-api-key
```

### Routes

[](#routes)

```
LARAVEL_WORKOS_ROUTES_AUTHENTICATE=authenticate
LARAVEL_WORKOS_REDIRECT_TO_ROUTE_NAME=dashboard
LARAVEL_WORKOS_ROUTES_LOGOUT=logout
LARAVEL_WORKOS_ROUTES_LOGIN=login
```

### Publish config (optional)

[](#publish-config-optional)

```
php artisan vendor:publish --tag="config" --provider="Codebarista\LaravelWorkos\LaravelWorkosServiceProvider"
```

3. Implementation
-----------------

[](#3-implementation)

Add the `HasRoles`, `HasPermissions` and `HasEntitlements` traits as needed to the User class, or any other that uses authentication.

```
namespace App\Models;

use Codebarista\LaravelWorkos\Traits\HasEntitlements;
use Codebarista\LaravelWorkos\Traits\HasPermissions;
use Codebarista\LaravelWorkos\Traits\HasRoles;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use HasEntitlements, HasPermissions, HasRoles;

    // ...
}
```

4. Usage
--------

[](#4-usage)

### WorkOS Role &amp; Permissions

[](#workos-role--permissions)

```
// e.g. use in Laravel policies
class EntryPolicy
{
    public function viewAny(User $user): bool
    {
        return $user->hasPermissionTo('entries:view') // custom WorkOS permission
            || $user->hasRole('org-editor'); // custom WorkOS organization role
    }

    // ...
}
```

### Stripe Product Entitlements

[](#stripe-product-entitlements)

#### Register Stripe customer for entitlements

[](#register-stripe-customer-for-entitlements)

```
php artisan codebarista:register-stripe-customer
```

#### Authorize with Stripe product entitlements

[](#authorize-with-stripe-product-entitlements)

```
// e.g. use in Laravel gates
protected function gate(): void
{
    Gate::define('viewNova', static function (User $user) {
        return $user->hasEntitlementTo('access-dashboard'); // custom Stripe entitlement
    });
}
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance96

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

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

Every ~50 days

Total

6

Last Release

18d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

authorizationentitlementslaravelpermissionsrolesstripeworkoslaravelrolespermissionsworkosentitlements

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/codebarista-laravel-workos/health.svg)

```
[![Health](https://phpackages.com/badges/codebarista-laravel-workos/health.svg)](https://phpackages.com/packages/codebarista-laravel-workos)
```

###  Alternatives

[jeremykenedy/laravel-roles

A Powerful package for handling roles and permissions in Laravel. Supports Laravel 5.3 up to 12.

1.0k817.6k6](/packages/jeremykenedy-laravel-roles)[beatswitch/lock-laravel

A Laravel Driver for Lock.

15329.0k1](/packages/beatswitch-lock-laravel)[hasinhayder/tyro

Tyro - The ultimate Authentication, Authorization, and Role &amp; Privilege Management solution for Laravel 12

6641.4k1](/packages/hasinhayder-tyro)[erag/laravel-role-permission

A simple and easy-to-install role and permission management package for Laravel, supporting versions 10.x and 11.x

404.2k](/packages/erag-laravel-role-permission)

PHPackages © 2026

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