PHPackages                             rydurham/sentinel - 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. rydurham/sentinel

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

rydurham/sentinel
=================

An implementation of the Sentry User Manager for Laravel.

v6.0.0(4y ago)31746.5k67[3 issues](https://github.com/rydurham/Sentinel/issues)BSD-3-ClausePHPPHP ^8

Since Jan 31Pushed 4y ago23 watchersCompare

[ Source](https://github.com/rydurham/Sentinel)[ Packagist](https://packagist.org/packages/rydurham/sentinel)[ RSS](/packages/rydurham-sentinel/feed)WikiDiscussions dev Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (88)Used By (0)

Sentinel: Sentry Implementation for Laravel
-------------------------------------------

[](#sentinel-sentry-implementation-for-laravel)

[![Build Status](https://camo.githubusercontent.com/33f2e0385e85423e2b74db0008061f47acb32c5b5ddda40ee551483d013128db/68747470733a2f2f7472617669732d63692e6f72672f727964757268616d2f53656e74696e656c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/rydurham/Sentinel)[![Total Downloads](https://camo.githubusercontent.com/cf5ca5959b44b9bf7a8fcbaacc0f189bc1f8db8dcddb66bd020b80451aa90092/68747470733a2f2f706f7365722e707567782e6f72672f727964757268616d2f73656e74696e656c2f642f746f74616c2e737667)](https://packagist.org/packages/rydurham/sentinel)[![License](https://camo.githubusercontent.com/e6df1e9a529466ccf8eec2a118e784fc7e03713335fe015a996a5c7a0a6d91c9/68747470733a2f2f706f7365722e707567782e6f72672f727964757268616d2f73656e74696e656c2f6c6963656e73652e737667)](https://packagist.org/packages/rydurham/sentinel)

This package provides an implementation of [Sentry 2](https://github.com/cartalyst/sentry) for [Laravel](https://github.com/laravel/laravel). By default it uses [Bootstrap 3.0](http://getbootstrap.com), but you can make use of whatever UI you want. It is intended to be a very simple way to get up and running with User access control very quickly. For simple projects you shouldn't need to do much more than drop it in and dial in the configuration.

The `cartalyst/sentry` auth package has been deprecated. If you are using it in production you should upgrade to `cartalyst/sentinel`. This package will also eventually be deprecated. **Do not use this package if you are starting a fresh application.**

**Important** There are two PHP packages named "Sentinel". This is `rydurham/sentinel`, not `cartalyst/sentinel`. The key difference is that this package is intended to be an implementation of Sentry v2, whereas Cartalyst released what would have been Sentry v3 under the name `cartalyst/sentinel`. The instructions below are specifically for `rydurham/sentinel`, make sure you are using the right package before proceeding.

If you are looking for a quick way to get up and running with `cartalyst/sentinel`. [I have created a bridge package that may be helpful](https://github.com/srlabs/centaur). If you are starting a new Laravel project, I recommend using that package instead of this one.

**Releases** There are several versions of this package, each intended for different versions of the Laravel framework.

Laravel VersionSentinel VersionPackagist Branch7.0.\*4.0.\*`"rydurham/sentinel": "~4.0"`8.0.\*5.0.\*`"rydurham/sentinel": "~5.0"`9.0.\*6.0.\*`"rydurham/sentinel": "~6.0"`### Laravel 5 Instructions

[](#laravel-5-instructions)

**Install the Package Via Composer:**

```
$ composer require rydurham/sentinel
```

Make sure you have configured your application's Database and Mail settings.

This package uses ["package discovery"](https://laravel.com/docs/5.5/packages#package-discovery) to automatically register it's service provider with your application.

**Register the Middleware in your `app/Http/Kernel.php` file:**

```
protected $routeMiddleware = [
    // ..
    'sentry.auth' => \Sentinel\Middleware\SentryAuth::class,
    'sentry.admin' => \Sentinel\Middleware\SentryAdminAccess::class,
    'sentry.member' => \Sentinel\Middleware\SentryMember::class,
    'sentry.guest' => \Sentinel\Middleware\SentryGuest::class,
];
```

**Publish the Views, Assets, Config files and migrations:**

```
php artisan sentinel:publish
```

You can specify a "theme" option to publish the views and assets for a specific theme:

```
php artisan sentinel:publish --theme="foundation"
```

Run `php artisan sentinel:publish --list` to see the currently available themes.

**Run the Migrations**Be sure to set the appropriate DB connection details in your `.env` file.

Note that you may want to remove the `create_users_table` and `create_password_resets_table` migrations that are provided with a new Laravel 5 application.

```
php artisan migrate
```

**Seed the Database:**

```
php artisan db:seed --class=SentinelDatabaseSeeder
```

More details about the default usernames and passwords can be [found here](https://github.com/rydurham/Sentinel/wiki/Seeds).

**Set a "Home" Route.**

Sentinel requires that you have a route named 'home' in your `routes.php` file:

```
// routes/web.php
Route::get('/', function () {
    return view('welcome');
})->name('home');
```

### Basic Usage

[](#basic-usage)

Once installed and seeded, you can make immediate use of the package via these routes:

- `yoursite.com/login`
- `yoursite.com/logout`
- `yoursite.com/register`
- `yoursite.com/users` - For user management. Only available to admins
- `yoursite.com/groups` - For group management. Only available to admins.

Sentinel also provides middleware which you can use to [prevent unauthorized access](http://laravel.com/docs/routing#route-filters) to your application's routes &amp; methods.

- `Sentinel\Middleware\SentryAuth` - Require users to have an active session
- `Sentinel\Middleware\SentryAdminAccess` - Block access for everyone except users who have the 'admin' permission.
- `Sentinel\Middleware\SentryMember` - Limit access to members of a certain group. The group name is case sensitive. For example:

```
// app\Http\Controllers\ExampleController.php
public function __construct()
{
    $this->middleware('sentry.member:Admins');
}
```

- `Sentinel\Middleware\SentryGuest` - Redirect users who have an active session

### Advanced Usage

[](#advanced-usage)

This package is intended for simple sites but it is possible to integrate into a larger application on a deeper level:

- Turn off the default routes (via the config) and manually specify routes that make more sense for your application
- Create a new User model that extends the default Sentinel User Model `Sentinel\Models\User`. Be sure to publish the Sentinel and Sentry config files (using the `sentinel:publish` command) and change the User Model setting in the Sentry config file to point to your new user model.
- Inject the `SentryUserRepository` and/or the `SentryGroupRepository` classes into your controllers to have direct access to user and group manipulation. You may also consider creating custom repositories that extend the repositories that come with Sentinel.

It is not advisable to extend the Sentinel controller classes; you will be better off in the long run creating your own controllers from scratch.

#### Using Sentinel in Tests

[](#using-sentinel-in-tests)

If you find yourself in the situation where you want to do tests with user logged in, go to your ``` tests/TestCase.php `` and add this method:

```
    use Illuminate\Events\Dispatcher;

   /**
     * Login to sentry for Testing purpose
     * @param  $email
     * @return void
     */
    public function sentryUserBe($email='admin@admin.com')
    {
        $user = \Sentry::findUserByLogin($email);
        \Sentry::login($user);
        (new dispatcher)->dispatch('sentinel.user.login', ['user' => $user]);
    }
```

You can then start testing your application with user logged in, as such:

```
class ExampleTest extends TestCase
{
    /**
     * Dashboard functional test example.
     *
     * @return void
     */
    public function testDashboardPage()
    {
        $this->sentryUserBe('admin@admin.com');
        $this->visit('/dashboard')
             ->see('dashboard');
    }
}
```

### Documentation &amp; Questions

[](#documentation--questions)

Check the [Wiki](https://github.com/rydurham/Sentinel/wiki) for more information about the package:

- Configuration Options
- Events &amp; Listeners
- Seed &amp; Migration Details
- Default Routes

Any questions about this package should be posted [on the package website](http://www.ryandurham.com/projects/sentinel/).

### Localization

[](#localization)

Sentinel has been translated into several other languages, and new translations are always welcome! Check out the [Sentinel Page](https://crowdin.com/project/sentinel) on CrowdIn for more details.

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity48

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 90.7% 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 ~35 days

Recently: every ~222 days

Total

83

Last Release

1560d ago

Major Versions

v1.4.27 → v2.1.72015-05-11

2.x-dev → v3.0.02019-09-04

v3.0.0 → v4.0.02020-03-04

v4.0.01 → v5.0.02020-09-09

v5.0.0 → v6.0.02022-02-09

PHP version history (11 changes)v1.0.0PHP &gt;=5.3.0

v1.4.9PHP &gt;=5.4.0

v2.2.0PHP &gt;=5.5.9

v2.5.0PHP &gt;=5.6.4

v2.6.1PHP &gt;=7.0.1

v2.8.0PHP &gt;=7.1.3

v3.0.0PHP ^7.2

v4.0.0PHP ^7.4

v4.0.01PHP ^7.2.5

v5.0.0PHP ^7.3

v6.0.0PHP ^8

### Community

Maintainers

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

---

Top Contributors

[![rydurham](https://avatars.githubusercontent.com/u/674347?v=4)](https://github.com/rydurham "rydurham (476 commits)")[![alograg](https://avatars.githubusercontent.com/u/8729740?v=4)](https://github.com/alograg "alograg (8 commits)")[![bachmay](https://avatars.githubusercontent.com/u/6717537?v=4)](https://github.com/bachmay "bachmay (5 commits)")[![stramel](https://avatars.githubusercontent.com/u/855184?v=4)](https://github.com/stramel "stramel (3 commits)")[![hongaar](https://avatars.githubusercontent.com/u/205834?v=4)](https://github.com/hongaar "hongaar (3 commits)")[![cyberhuman](https://avatars.githubusercontent.com/u/979624?v=4)](https://github.com/cyberhuman "cyberhuman (3 commits)")[![basjac](https://avatars.githubusercontent.com/u/6992553?v=4)](https://github.com/basjac "basjac (3 commits)")[![adis-io](https://avatars.githubusercontent.com/u/592907?v=4)](https://github.com/adis-io "adis-io (2 commits)")[![kamaroly](https://avatars.githubusercontent.com/u/3633772?v=4)](https://github.com/kamaroly "kamaroly (2 commits)")[![kjventura](https://avatars.githubusercontent.com/u/1684880?v=4)](https://github.com/kjventura "kjventura (2 commits)")[![the0rem](https://avatars.githubusercontent.com/u/5077986?v=4)](https://github.com/the0rem "the0rem (2 commits)")[![2bj](https://avatars.githubusercontent.com/u/71068?v=4)](https://github.com/2bj "2bj (2 commits)")[![cryptoBOOOOM](https://avatars.githubusercontent.com/u/3755177?v=4)](https://github.com/cryptoBOOOOM "cryptoBOOOOM (2 commits)")[![yilmazerhakan](https://avatars.githubusercontent.com/u/3083808?v=4)](https://github.com/yilmazerhakan "yilmazerhakan (1 commits)")[![chemerys](https://avatars.githubusercontent.com/u/4155841?v=4)](https://github.com/chemerys "chemerys (1 commits)")[![darit](https://avatars.githubusercontent.com/u/3360243?v=4)](https://github.com/darit "darit (1 commits)")[![eliasrodrigues](https://avatars.githubusercontent.com/u/216529?v=4)](https://github.com/eliasrodrigues "eliasrodrigues (1 commits)")[![falonofthetower](https://avatars.githubusercontent.com/u/6103923?v=4)](https://github.com/falonofthetower "falonofthetower (1 commits)")[![james2doyle](https://avatars.githubusercontent.com/u/1425304?v=4)](https://github.com/james2doyle "james2doyle (1 commits)")[![JamieMagee](https://avatars.githubusercontent.com/u/1358764?v=4)](https://github.com/JamieMagee "JamieMagee (1 commits)")

---

Tags

laravelauthsentry

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rydurham-sentinel/health.svg)

```
[![Health](https://phpackages.com/badges/rydurham-sentinel/health.svg)](https://phpackages.com/packages/rydurham-sentinel)
```

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M350](/packages/tymon-jwt-auth)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M53](/packages/php-open-source-saver-jwt-auth)[auth0/login

Auth0 Laravel SDK. Straight-forward and tested methods for implementing authentication, and accessing Auth0's Management API endpoints.

2745.0M3](/packages/auth0-login)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)[vinkas/firebase-auth-laravel

Firebase Authentication package for Laravel PHP Framework

392.1k](/packages/vinkas-firebase-auth-laravel)

PHPackages © 2026

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