socialiteproviders/mailru
Adds Mail.ru OAuth login to Laravel Socialite. This provider lets your Laravel app authenticate users through Mail.ru using a standard Socialite driver, with configuration for client ID, secret, and redirect URI. Install via Composer and register the provider.
composer require, one controller, one config block — no new infrastructure, no vendor contract, no new service in the architecture diagram. It turns "should we localize login for this market?" from a quarter-long platform project into a two-day spike you can ship behind a feature flag.social_accounts table (provider, provider_user_id, user_id, tokens) rather than columns on users. That single schema decision is the real product artifact here — it makes every future provider (VK, Yandex, Google, Apple) an additive change rather than a migration. Approve the schema decision, not just the package.Adopt when:
Socialite::driver() call site, same controller pattern, same test-mocking boundary. Incremental cost is near zero.config:cache staleness, InvalidStateException handling on a high-traffic callback, and email being nullable.Look elsewhere when:
laravel/socialite + socialiteproviders/manager + one community driver purely to get a single provider is a heavier architectural commitment than it appears, and you inherit a second dependency chain for one login button.For executives — one paragraph. We can add Mail.ru sign-in to the product in roughly two engineer-days, with no new infrastructure, no vendor contract, and no database migration beyond a small identity table we should build anyway. It's a low-cost way to test whether Russian-speaking/CIS markets are worth investing in, and it's fully reversible if the data doesn't support it. The honest caveats: this is a free community-maintained adapter whose last release was in 2022, Mail.ru's identity platform is being consolidated into VK ID, and we'd own the operational edge cases. So the recommendation is to treat it as a scoped, flagged experiment with an explicit review date — not as a permanent, load-bearing piece of our authentication stack. Success is measured as conversion lift for that segment; failure costs us two days and one config file.
For engineering — the essentials. composer require socialiteproviders/mailru; register the driver via a SocialiteWasCalled event listener (extendSocialite('mailru', Provider::class)) in AppServiceProvider::boot(); add credentials to config/services.php and the byte-identical redirect URI to the Mail.ru console. Keep OAuth in a dedicated controller or action class. Model identity as social_accounts keyed on provider_user_id — never email, which can be null for phone-only accounts. Wrap the callback in try/catch and redirect to login with a flash message rather than 500-ing on InvalidStateException. Decide stateful vs. stateless per entry point and be consistent on both legs. Mock at the Socialite boundary for tests. Subclass and override mapUserToObject() for Mail.ru-specific fields rather than forking.
The three things that will actually break, in order: the listener registration (Driver [mailru] is not supported), a stale config:cache after credential changes, and a redirect-URI mismatch (scheme, www, trailing slash, or proxy-generated http:// URLs). Budget the debugging time there, not in the provider class.
Two questions to answer before we start, not after: (1) What's in the 4.1.0 → 4.1.1 diff — Composer metadata only, or does it touch the provider class? (2) Are the endpoints this provider targets still the officially recommended surface, or has VK ID superseded them? If the answer to (2) is "superseded," we should scope the experiment accordingly and plan for a swap.
How can I help you explore Laravel packages today?