- How do I install mortezamasumi/fb-user in a Laravel application?
- Install it with Composer by running composer require mortezamasumi/fb-user from your project root. Laravel's package auto-discovery should register the service provider automatically; if the package ships a configuration file, publish it with php artisan vendor:publish and select the fb-user provider tag. Check the repository README for the exact publish tag and any required migration steps.
- Which Laravel versions does mortezamasumi/fb-user support?
- The package is built for Laravel applications and is described as lightweight and easy to configure, but the exact version constraints are not listed in the provided overview. Check the require section of the package's composer.json on Packagist or GitHub before installing. If you are on an older Laravel release, verify compatibility first, since Facebook API and framework changes can affect authentication flows.
- How do I configure my Facebook app credentials for this package?
- Create an app in the Meta for Developers console, then add its app ID and app secret to your Laravel environment. After publishing the package config, map those values to the package's configuration keys and set the OAuth redirect URI to match the callback route registered by the package. Keep the secret out of version control and cache your config with php artisan config:clear after changes.
- Can fb-user work with my existing Eloquent User model and auth flow?
- Yes, the package is explicitly designed to fit existing Eloquent models and authentication flows rather than replacing them. In practice you store the Facebook user identifier on your users table or a linked accounts table, then resolve or create the matching Eloquent user after the Facebook callback. Consult the README for the expected column names and any published migration before wiring it into your login controller.
- What Facebook profile data can I retrieve with this package?
- The package retrieves Facebook user profile data through the Facebook API, typically including the Facebook user ID, name, and email when the user grants the matching permissions. Which fields are available depends on the scopes you request and what the user consents to share, so email and other details can be missing. Always treat returned fields as optional and validate before persisting them.
- Do I need Laravel Socialite to use mortezamasumi/fb-user?
- No, this package handles Facebook account integration itself through the Facebook API, so Socialite is not a stated requirement. It is a lighter, Facebook-specific option compared with Socialite's multi-provider approach. Review the package's composer dependencies to confirm exactly what it pulls in before adding it alongside Socialite.
- How can I test Facebook login in my Laravel app without calling the real API?
- Avoid hitting Facebook in automated tests by faking the HTTP layer with Laravel's Http::fake helper or by mocking the package's client class in your test container. Cover the callback path with a stubbed profile response and assert that the correct Eloquent user is created or linked. Keep a small number of manual staging tests against a Facebook test app to catch scope and redirect URI issues.
- Is mortezamasumi/fb-user safe to use in production?
- The package is described as lightweight and focused on authentication and profile retrieval, so production safety depends largely on how you handle the returned tokens and user data. Store Facebook access tokens securely, never log them, serve everything over HTTPS, and treat the Facebook user ID as a unique index to prevent duplicate accounts. Review the source and pin a specific version before deploying to production.
- How should I handle new versus existing users when someone signs in with Facebook?
- Look up a user by the stored Facebook identifier first, then fall back to matching on a verified email if your account-linking policy allows it. Create a new Eloquent user when no match exists, and decide deliberately whether to link a Facebook account to an existing password-based account. Because Facebook may not return an email, be prepared to prompt the user for one instead of failing silently.
- What are the alternatives to mortezamasumi/fb-user for Facebook login in Laravel?
- Laravel Socialite is the official first-party option and supports Facebook alongside many other providers, which suits apps needing multiple login methods. This package is a narrower, Facebook-only choice that may be simpler if Facebook is your only integration and you want it to fit existing Eloquent auth flows. Compare maintenance activity, test coverage, and Laravel version support before choosing.