PHPackages                             cswni/filament-companies - 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. cswni/filament-companies

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

cswni/filament-companies
========================

A Laravel Authentication System based on Companies built using Filament

1.1.10(2y ago)1179MITPHPPHP ^8.0

Since Jul 23Pushed 2y agoCompare

[ Source](https://github.com/cswni/filament-companies)[ Packagist](https://packagist.org/packages/cswni/filament-companies)[ Docs](https://github.com/andrewdwallo/filament-companies)[ RSS](/packages/cswni-filament-companies/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (11)Versions (21)Used By (0)

[![gif (1)](https://user-images.githubusercontent.com/104294090/221399175-add7c34b-4887-49b7-9061-6781f6391409.gif)](https://user-images.githubusercontent.com/104294090/221399175-add7c34b-4887-49b7-9061-6781f6391409.gif)

 [ ![FILAMENT 8.x](https://camo.githubusercontent.com/c98f15eb6bb59ce4fc768808e21fd46a07d238312928102f3d7ad4bed7c31f70/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46494c414d454e542d322e782d4542423330343f7374796c653d666f722d7468652d6261646765) ](https://filamentadmin.com/docs/2.x/admin/installation) [ ![Packagist](https://camo.githubusercontent.com/cc22a08d9df378266899836b51510b085eaf252ca9aef3a3081977a257beb3f0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616e647265776477616c6c6f2f66696c616d656e742d636f6d70616e6965732e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374) ](https://packagist.org/packages/andrewdwallo/filament-companies) [ ![Downloads](https://camo.githubusercontent.com/2ef8a37c7adacd17f0c65f5a128fac355ca44dbf5513afced615dcd34fb04853/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616e647265776477616c6c6f2f66696c616d656e742d636f6d70616e6965733f636f6c6f723d726564267374796c653d666f722d7468652d6261646765) ](https://packagist.org/packages/andrewdwallo/filament-companies)

---

Filament Companies
==================

[](#filament-companies)

A Complete Authentication System Kit based on Companies built for Filament:

- 🔥 **Authentication - Fortify**
- 🔥 **Socialite (Optional)**
- 🔥 **Terms &amp; Privacy Policy**
- 🔥 **Password Reset via Email**
- 🔥 **Personal Profile Management**
- 🔥 **Two-Factor Authentication (2FA)**
- 🔥 **Browser Session Management**
- 🔥 **Sanctum API**
- 🔥 **Company Management**
- 🔥 **Employee Invitations via Email**
- 🔥 **Roles &amp; Permissions**
- 🔥 **And More to Come!**

Getting Started
===============

[](#getting-started)

### WARNING

[](#warning)

- This plugin requires a fresh Filament project.
- If you install this plugin into an existing Filament project, you will get errors.

### Note

[](#note)

- Example application using package:

### Getting Set Up

[](#getting-set-up)

- Create a fresh Laravel Project
- Configure your database
- Install the filament admin package

```
composer require filament/filament
```

Installation
============

[](#installation)

Install this package

```
composer require andrewdwallo/filament-companies
```

After installing the package, you may execute the `filament-companies:install` Artisan command. This command requires the name of the stack to be `filament` and the option to be `--companies`. In addition, you may use the `--socialite` switch to enable socialite support.

Use one of the following commands to scaffold the application:

```
php artisan filament-companies:install filament --companies

php artisan filament-companies:install filament --companies --socialite
```

### Finalizing Installation

[](#finalizing-installation)

```
php artisan migrate:fresh
```

```
npm run dev
```

### Translations

[](#translations)

If you wish to translate the package, you may publish the language files using:

```
php artisan vendor:publish --tag=filament-companies-translations
```

Usage
=====

[](#usage)

If you would like, you may create a new account using:

```
php artisan make:filament-companies-user
```

> You may also create a new account by registering through the application.

In the Laravel Welcome Page, you may:

- Login
- Register

In the company dropdown, you may:

- Create a new company
- Manage your current company's settings
- Switch your current company

In the user dropdown, where your avatar is, you may:

- Create API Tokens
- Manage your personal profile's settings

This package is extensively "borrowed" from the work of Taylor Otwell, his contributors and the Laravel Jetstream package. You can get a full understanding of the capabilities by reviewing the Jetstream [Documentation](https://jetstream.laravel.com/2.x/introduction.html/).

If you want to change the filament path prefix to something such as "company", you may do so as you normally would in `config/filament.php`

```
    /*
    |--------------------------------------------------------------------------
    | Filament Path
    |--------------------------------------------------------------------------
    |
    | The default is `admin` but you can change it to whatever works best and
    | doesn't conflict with the routing in your application.
    |
    */

    'path' => env('FILAMENT_PATH', 'company'),
```

> The Laravel Welcome Page &amp; Fortify will respect your changes

### Socialite

[](#socialite)

By Default, the GitHub Provider will be enabled.

You may use any Provider that [Laravel Socialite](https://laravel.com/docs/10.x/socialite/) supports.

You may add or remove any Provider in `config/filament-companies.php`

```
    /*
    |--------------------------------------------------------------------------
    | Socialite Providers
    |--------------------------------------------------------------------------
    |
    | Here you may specify the providers your application supports for OAuth.
    | Out of the box, FilamentCompanies provides support for all the OAuth
    | providers that are supported by Laravel Socialite.
    |
    */

    'providers' => [
        Providers::github(),
        Providers::google(),
        Providers::gitlab(),
        Providers::bitbucket(),
        Providers::facebook(),
        Providers::linkedin(),
        Providers::twitterOAuth1(),
        Providers::twitterOAuth2(),
    ],
```

> If Twitter is desired, you may only use either Twitter OAuth1 or Twitter OAuth2, not both.

You may use this syntax if it is desired.

```
    /*
    |--------------------------------------------------------------------------
    | Socialite Providers
    |--------------------------------------------------------------------------
    |
    | Here you may specify the providers your application supports for OAuth.
    | Out of the box, FilamentCompanies provides support for all the OAuth
    | providers that are supported by Laravel Socialite.
    |
    */

    'providers' => [
        github,
        google,
        gitlab,
        bitbucket,
        facebook,
        linkedin,
        twitter,
        twitter-oauth-2,
    ],
```

In `config/services.php` pass your Provider's credentials in the providers array:

```
    /*
    |--------------------------------------------------------------------------
    | Third Party Services
    |--------------------------------------------------------------------------
    |
    | This file is for storing the credentials for third party services such
    | as Mailgun, Postmark, AWS and more. This file provides the de facto
    | location for this type of information, allowing packages to have
    | a conventional file to locate the various service credentials.
    |
    */

    'github' => [
        'client_id' => env('GITHUB_CLIENT_ID'),
        'client_secret' => env('GITHUB_CLIENT_SECRET'),
        'redirect' => 'https://filament.test/oauth/github/callback',
    ],
```

> The Provider's Redirect URI must look similar to the above (e.g. 'APP\_URL/oauth/provider\_name/callback')

An Example: How to Set Up GitHub (using Filament as Application Name &amp; APP\_URL)

1. Go to
2. Application Name: `Filament`
3. Homepage URL: `https://filament.test/admin`
4. Authorization callback URL: `https://filament.test/oauth/github/callback`
5. Click on Device Flow &amp; Save
6. Copy the Client Secret &amp; store somewhere safe.

> Authorization callback URL = 'redirect' from above

In the `.env` file, for example:

```
GITHUB_CLIENT_ID=aluffgef97f9f79f434t
GITHUB_CLIENT_SECRET=hefliueoioffbo8338yhf2p9f4g2gg33
```

You may temporarily turn off Socialite support if you previously chose it as an option during installation:

```
    /*
    |--------------------------------------------------------------------------
    | Features
    |--------------------------------------------------------------------------
    |
    | Some of Company's features are optional. You may disable the features
    | by removing them from this array. You're free to only remove some of
    | these features, or you can even remove all of these if you need to.
    |
    */

    'features' => [
        Features::termsAndPrivacyPolicy(),
        Features::profilePhotos(),
        Features::api(),
        Features::companies(['invitations' => true]),
        Features::accountDeletion(),
        // Features::socialite(['rememberSession' => true, 'providerAvatars' => true]),
    ],
```

The Socialite package is extensively "borrowed" from the work of Joel Butcher, his contributors and the Socialstream package. You can get a full understanding of the capabilities by reviewing the Socialstream [Documentation](https://docs.socialstream.dev/).

The following examples are a visual representation of the features this package supports that were provided by the methods implemented in Laravel Jetstream. You may find all of the features as provided by the Laravel Jetstream package [here](https://jetstream.laravel.com/3.x/features/teams.html) in their documentation.

Information about a user's companies may be accessed via the methods provided by the `Wallo\FilamentCompanies\HasCompanies` trait. This trait is automatically applied to your application's `App\Models\User` model during installation. This trait provides a variety of helpful methods that allow you to inspect a user's companies or company:

```
// Access a user's currently selected company...
$user->currentCompany : Wallo\FilamentCompanies\Company

// Access all of the companies (including owned companies) that a user belongs to...
$user->allCompanies() : Illuminate\Support\Collection

// Access all of a user's owned companies...
$user->ownedCompanies : Illuminate\Database\Eloquent\Collection

// Access all of the companies that a user belongs to but does not own...
$user->companies : Illuminate\Database\Eloquent\Collection

// Access a user's "personal" company...
$user->personalCompany() : Wallo\FilamentCompanies\Company

// Determine if a user owns a given company...
$user->ownsCompany($company) : bool

// Determine if a user belongs to a given company...
$user->belongsToCompany($company) : bool

// Get the role that the user is assigned on the company...
$user->companyRole($company) : \Wallo\FilamentCompanies\Role

// Determine if the user has the given role on the given company...
$user->hasCompanyRole($company, 'admin') : bool

// Access an array of all permissions a user has for a given company...
$user->companyPermissions($company) : array

// Determine if a user has a given company permission...
$user->hasCompanyPermission($company, 'server:create') : bool
```

> $user represents the current user of the application. Interchangeable with `Auth::user()`

Example #1: Only allowing a certain company ID to see &amp; visit a filament page, resource, etc...

```
protected static function shouldRegisterNavigation(): bool
{
    return Auth::user()->currentCompany->id === 3;
}

public function mount(): void
{
    abort_unless(Auth::user()->currentCompany->id === 3, 403);
}
```

Example #2: Using the Current Company Name

```
protected static function shouldRegisterNavigation(): bool
{
    return Auth::user()->currentCompany->name === "Filament";
}

public function mount(): void
{
    abort_unless(Auth::user()->currentCompany->name === "Filament", 403);
}
```

> You can use collections of different companies and group them together, or you may use different ranges of values, and more.

### Company Invitations

[](#company-invitations)

In my opinion, if you are using GMAIL &amp; you are testing, this is the easiest route to setup the Mail Server:

1. Go to  (May ask you to Sign in)
2. Click on "Select app", enter name of Application, then click "Generate".
3. Copy your app password and store it somewhere safe.

In your application's `.env` file, for example:

```
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=yourgmailusername@gmail.com
MAIL_PASSWORD=of9f9279g924792g49t           # GMAIL App Password
MAIL_ENCRYPTION=tsl                         # tsl is recommended over ssl
MAIL_FROM_ADDRESS="filament@company.com"
MAIL_FROM_NAME="${APP_NAME}"
```

> Port does not have to be specific

### Roles &amp; Permissions

[](#roles--permissions)

You may change roles &amp; permissions in `app/Providers/FilamentCompaniesServiceProvider.php`

```
/**
 * Configure the roles and permissions that are available within the application.
 */
protected function configurePermissions(): void
{
    FilamentCompanies::defaultApiTokenPermissions(['read']);

    FilamentCompanies::role('admin', 'Administrator', [
        'create',
        'read',
        'update',
        'delete',
    ])->description('Administrator users can perform any action.');

    FilamentCompanies::role('editor', 'Editor', [
        'read',
        'create',
        'update',
    ])->description('Editor users have the ability to read, create, and update.');
}
```

### Notice

[](#notice)

- This package is planned to be used as a Context in Filament V3.
- The default view after installation is not supposed to be the "Admin" Context, this would be the view that a "company owner" or "company user" would see.
- There are methods to support an "Admin" Context if desired.

### Contributing

[](#contributing)

- Fork this repository to your GitHub account.
- Create a fresh Laravel &amp; Filament Project.
- Clone your fork in your App's root directory.
- In the `/filament-companies` directory, create a branch for your fix, e.g. `fix/error-message`.

Install the package in your application's `composer.json` file using the `dev` prefix followed by your branches name:

```
{
    ...
    "require": {
        "andrewdwallo/filament-companies": "dev-fix/error-message",
    },
    "repositories": [
        {
            "type": "path",
            "url": "filament-companies/"
        }
    ],
    ...
}
```

Now, run `composer update` and continue by following the installation instructions above.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.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 ~0 days

Total

20

Last Release

1014d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0415537a74f94340a66fe825a0890758e5dc816ace241cba183c8128bfc9918e?d=identicon)[cswni](/maintainers/cswni)

---

Top Contributors

[![andrewdwallo](https://avatars.githubusercontent.com/u/104294090?v=4)](https://github.com/andrewdwallo "andrewdwallo (223 commits)")[![cswni](https://avatars.githubusercontent.com/u/14812743?v=4)](https://github.com/cswni "cswni (19 commits)")[![rjbh1971](https://avatars.githubusercontent.com/u/75685372?v=4)](https://github.com/rjbh1971 "rjbh1971 (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![Pawooo](https://avatars.githubusercontent.com/u/106813449?v=4)](https://github.com/Pawooo "Pawooo (2 commits)")[![realslimsutton](https://avatars.githubusercontent.com/u/87341175?v=4)](https://github.com/realslimsutton "realslimsutton (2 commits)")[![margarizaldi](https://avatars.githubusercontent.com/u/26832856?v=4)](https://github.com/margarizaldi "margarizaldi (1 commits)")[![mstfkhazaal](https://avatars.githubusercontent.com/u/47450090?v=4)](https://github.com/mstfkhazaal "mstfkhazaal (1 commits)")

---

Tags

laravelauthtailwindERPfilamentandrewdwallocompanieswallo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cswni-filament-companies/health.svg)

```
[![Health](https://phpackages.com/badges/cswni-filament-companies/health.svg)](https://phpackages.com/packages/cswni-filament-companies)
```

###  Alternatives

[andrewdwallo/filament-companies

A comprehensive Laravel authentication and authorization system designed for Filament, focusing on multi-tenant company management.

34450.0k2](/packages/andrewdwallo-filament-companies)[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M350](/packages/tymon-jwt-auth)[laravel/jetstream

Tailwind scaffolding for the Laravel framework.

4.1k19.8M136](/packages/laravel-jetstream)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M53](/packages/php-open-source-saver-jwt-auth)[dutchcodingcompany/filament-socialite

Social login for Filament through Laravel Socialite

213914.9k9](/packages/dutchcodingcompany-filament-socialite)

PHPackages © 2026

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