cartalyst/sentinel
Framework-agnostic authentication and authorization system for PHP 8.3+ with Laravel support. Provides user management, roles and permissions, login/throttling, activation and password reset flows, and additional security features.
Install via Composer for Laravel 12+ (requires PHP 8.3+):
composer require cartalyst/sentinel
Auto-discovery registers the service provider—no manual providers entry needed. Publish config and migrations with:
php artisan vendor:publish --provider="Cartalyst\Sentinel\Laravel\SentinelServiceProvider"
Review config/sentinel.php to tailor activation requirements, persistence lifetimes, and permission resolution logic. Run migrations to seed tables (users, roles, permissions, activations, reminders, persistences). Crucially, the very first user created via Sentinel::registerAndLogin() auto-activates, so avoid assuming all users require manual activation—this behavior only applies to the first registered user.
Sentinel::authenticate($credentials) for login (validates password & activation) and Sentinel::check() to verify session state. For API use, prefer Sentinel::findByCredentials($credentials) + manual persistence handling to avoid session side effects.$user->roles()->attach($role). Check with instance methods ($user->inRole('admin')) or static helpers (Sentinel::hasAccess('admin.dashboard')). Define permissions hierarchically in sentinel.php config (e.g., 'admin' => ['user.*']) and use wildcard patterns ('admin.*') for scalable access control.Sentinel::register($attributes), then either call Sentinel::activate($user) or rely on auto-activation (only for first user). For password resets, generate reminders via Sentinel::getReminderRepository()->create($user) and validate with Sentinel::completeRemind($user, $code).throttle section. Manually inspect via Sentinel::throttle()->check($user) or clear blocks with Sentinel::throttle()->resume($user) after manual review.Cartalyst\Sentinel\Users\EloquentUser to add soft deletes, custom attributes, or relationships. Register the model in config('sentinel.users') to override defaults.Sentinel::activate(). Always verify $user->hasAccess() before assuming activation status.'user.edit') override wildcard patterns (e.g., 'user.*'). Avoid overlapping rules—e.g., defining both 'user' => ['edit', 'delete'] and 'user.*' => true can cause unpredictable hasAccess() results.persistences table and cookies. Never delete entries manually; always use Sentinel::logout() to invalidate both session and persistence. For long-lived sessions, use Sentinel::loginAndEnterPersistence($user, true).sentinel.persistence.driver = cookie and handle tokens manually using findUserByPersistenceCode($code) + custom auth guards.Sentinel::getCheckpoints()—this reveals whether failures stem from activation, throttling, or password validation.php artisan migrate.How can I help you explore Laravel packages today?