mortezamasumi/fb-auth
Facebook authentication for Laravel: a small package that wires up the Facebook OAuth login flow so users can sign in with their Facebook account. It provides the redirect and callback handling needed to integrate Facebook login into your app's existing authentication setup.
Confirm the constraints before anything else: this package targets PHP 8.5 / Laravel 12 / Filament 5 (per agents/AGENTS.md), which is a narrow window. Read composer.json first — if your app is on Laravel 11 or PHP 8.3, stop here.
Then:
composer require mortezamasumi/fb-authphp artisan vendor:publish and select the fb-auth tags. The only knob most teams touch is fb-auth.auth_type, which accepts link, code, mobile, or user.->plugin(FbAuthPlugin::make()).code needs working mail; mobile needs the sibling packages mortezamasumi/fb-sms (with fb-sms.operator configured) and ariaieboy/filament-jalali.Where to look first, in order: src/FbAuthPlugin.php (the wiring point — it substitutes Filament's login/register/password-reset/email-verification pages based on Enums/AuthType), config/fb-auth.php, src/FbAuth.php (OTP generation/caching), then src/Pages/ for the flow you're enabling.
First use case: swap Filament's password login for emailed one-time codes. Set auth_type to code, ensure the panel user model implements MustVerifyEmail if you also want the verification flow, and click through login. That single change is the fastest way to see the plugin's whole personality.
Let the plugin fill defaults, override deliberately. FbAuthPlugin only replaces Filament pages the panel hasn't already customized. The idiomatic pattern is to accept the plugin's pages for flows you don't care about and pin your own class for the one you do:
->plugin(FbAuthPlugin::make())
->login(App\Filament\Pages\Auth\MyCodeLogin::class)
Subclass the package page rather than forking it — that keeps you on the upgrade path.
Two ways to consume the OTP logic. Inside Filament you get it for free; outside (API endpoints, custom Livewire components, artisan tooling) resolve the FbAuth facade. Codes are cached under otp-{identifier}, where the identifier is mobile for the mobile flow and email otherwise. Both send and verify are rate-limited at 2 requests/minute, so design your UX around that ceiling rather than discovering it in production.
Keep notification delivery swappable. Email codes go through Laravel notifications (src/Notifications/); mobile codes route through fb-sms. If your team has an existing transactional email provider, wrap or replace those notification classes instead of letting two mail paths diverge.
Email verification is opt-in on both sides. It only replaces Filament's signed-link flow when the panel calls ->emailVerification() and the user model implements MustVerifyEmail. Enable the panel flag without the interface and nothing happens — silently.
Testing pattern worth copying. The package tests with Orchestra Testbench + Pest, building the entire environment inline in tests/TestCase.php: it creates users and password_reset_tokens, registers an admin panel at / with every feature plus the plugin, and loads provider lists for Filament/Livewire/fb-essentials/fb-sms. If you write your own integration tests (you should), mirror that structure — it's the only honest documentation of how the pieces fit. Note AUTH_MODEL in phpunit.xml.dist points at tests/Services/User.php, and the DB is SQLite :memory: with RefreshDatabase.
Match their CI before you push a PR: vendor/bin/pint --test → phpstan analyse (level 8 via Larastan) → pest --ci, in that order.
agents/AGENTS.md and trust it over the description.toEN() is not a method. It's a runtime macro registered by the sibling mortezamasumi/fb-essentials package; PHPStan ignores it via phpstan.neon.dist. Don't "fix" it away, and don't assume it exists unless fb-essentials is installed — otherwise TextInput fields blow up at runtime, not at static-analysis time.resources/dist/ is committed. Assets are served from there via FbAuthServiceProvider::getAssets(). If you touch resources/css/index.css or resources/js/index.js, run npm run build and commit the output — otherwise Filament serves stale CSS/JS and you'll debug a phantom caching problem.resources/lang/en/fb-auth.php and resources/lang/fa/fb-auth.php. Changing one without the other is a bug, and the Persian side carries RTL + Jalali date concerns that tests won't catch for you.otp-{identifier} is a bare key. On shared cache stores or multi-tenant deployments, prefix it or you'll see cross-tenant collisions. Also verify your cache driver in each environment — array in tests, and a misconfigured production store means codes simply never land.feat:, fix:, chore:) because semantic-release auto-publishes from pushes to main/next. Don't hand-edit CHANGELOG or version numbers in a fork.fb-sms, fb-essentials). Pin the version, keep the panel plugin registration in one place, and be prepared to fall back to Filament's native pages if maintenance lapses.fb-sms.operator set for mobile → rate limit not already exhausted (2/min) → identifier matches exactly what the user typed (email vs mobile).How can I help you explore Laravel packages today?