smorken/auth
Laravel authentication package that provides ready-made login, registration, and password reset flows. It integrates with Laravel's auth system and offers configurable routes, views, and guards to help secure your application quickly.
smorken/auth is not on Packagist. The first step is making Composer aware of the Bitbucket repository, then pinning a commit so builds are reproducible.
// composer.json
"repositories": [
{
"type": "vcs",
"url": "https://bitbucket.org/scott_morken/auth.git"
}
],
"require": {
"smorken/auth": "dev-master#<commit-sha>"
}
Bitbucket HTTPS clones often require credentials. If composer require hangs or returns 403, add a Bitbucket app password to auth.json or switch to SSH:
"url": "[email protected]:scott_morken/auth.git"
Before writing application code, inspect the package in this order:
composer.json — check the require block for Laravel and PHP constraints. This is the compatibility gate; do not assume it supports your Laravel version.README.md — the only reliable description of public API, config keys, middleware aliases, and published views.src/ — locate the service provider, any facade, config file, controllers, middleware, model traits, and migrations.tests/ — if absent, treat every flow as unverified and write your own feature tests.Then publish whatever the package exposes:
php artisan vendor:publish --provider="Smorken\Auth\AuthServiceProvider"
If auto-discovery is not declared in the package’s composer.json, manually register the provider in config/app.php.
First use case: protect a single route with the package’s auth middleware and prove the login flow end-to-end in a throwaway branch. Do not start with registration or password reset — login is the smallest surface that exercises guard, provider, session, and redirect configuration together.
// routes/web.php
Route::middleware(['auth'])->group(function () {
Route::get('/dashboard', DashboardController::class);
});
If the package supplies its own middleware alias, use that alias exactly as documented; otherwise fall back to Laravel’s auth middleware and verify the package’s guard is the default.
Wrap the package behind an internal adapter. Day-to-day calls should go through your own service or facade, not directly to package classes. This gives you a one-file swap-out path when the package is abandoned or a Laravel upgrade breaks it.
namespace App\Auth;
use Smorken\Auth\SomePackageClass;
class AuthService
{
public function login(array $credentials): bool
{
return SomePackageClass::attempt($credentials);
}
}
Configure guards and providers explicitly. In config/auth.php, confirm the package’s guard driver and user provider are registered against your actual user model. Do not rely on the package overwriting framework defaults. If the package publishes its own config/auth.php, diff it against your existing config rather than replacing it.
Protect routes with middleware groups, not per-route middleware. Apply the package’s middleware alias to a group so login, logout, and redirect behavior stays consistent.
Route::middleware(['auth:web'])->group(function () {
Route::get('/account', [AccountController::class, 'show']);
});
Override views and redirects through config, not by editing vendor files. Publish views, then set the package’s view namespace or redirect keys in config/auth.php or the package’s published config. Keep custom login/register views in resources/views/auth/ and point the package at them.
Treat registration and password reset as separate integrations. Each has its own controller, validation, broker, and redirect path. Enable them one at a time:
Use Laravel’s native testing helpers. Write feature tests for each flow before relying on the package in a shared branch.
public function test_user_can_login(): void
{
$user = User::factory()->create(['password' => bcrypt('secret')]);
$this->post('/login', [
'email' => $user->email,
'password' => 'secret',
])->assertRedirect('/dashboard');
$this->assertAuthenticatedAs($user);
}
Keep the user model framework-native. The package expects an Authenticatable model. Do not add package-specific traits unless the source clearly requires them; prefer Laravel’s Authenticatable, Notifiable, and standard password broker contracts.
Use it as a reference implementation where possible. If the package’s only value is scaffolding, copy the relevant patterns into your own auth layer and remove the dependency. That is often the lowest-risk way to “leverage” an unmaintained helper.
dev-master. A branch rename or repository visibility change can break every clean build simultaneously. Use dev-master#<sha> and cache Composer dependencies in CI.composer.json targets Laravel 5.x or 8.x, do not attempt to install it on Laravel 10/11 without reading the source for guard contract changes.config/app.php and run composer dump-autoload.config/auth.php before running vendor:publish, and diff rather than replace.web or assume a default guard. If your app uses multiple guards or a custom session guard, test login, logout, remember-me, and password reset separately.app/Http/Kernel.php for existing aliases before registering the package’s middleware. Prefer a distinct alias if the package provides one.resources/views/auth, it can collide with Breeze/Jetstream or your own auth views. Publish to a package namespace and override selectively.php artisan route:list, php artisan config:show auth, and Auth::guard()->check() inside a test route to confirm which guard is active. If the package registers its own guard driver, inspect config/auth.php for the driver name.How can I help you explore Laravel packages today?