Easily sign-in and poll users and groups in Microsoft Entra
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/networkrailbusinesssystems/entra
Requires
- php: ^8.3
- dcblogdev/laravel-microsoft-graph: ^4
- illuminate/support: ^12
Requires (Dev)
This package is auto-updated.
Last update: 2025-12-02 08:44:03 UTC
README
Easily sign-in and poll users and groups in Microsoft Entra, built using Laravel Microsoft Graph.
Setup
- Install this library using
Composer:composer require networkrailbusinesssystems/entra
- Publish the Entra configuration file using
Artisan:php artisan vendor:publish --provider="NetworkRailBusinessSystems\Entra\EntraServiceProvider" --tag="entra"
- Adjust the
entra.phpconfiguration file to suit your needs.sync_attributeswill automatically create and update Models to match the details from Entrauser_modelshould be the fully qualified class name of the Model used for Laravel authentication
- Implement the
EntraAuthenticatableinterface on your chosen Model - Add the
AuthenticatesWithEntratrait on your chosen Model for a standard fetch and sync setup, or implement the methods yourself - Add the Entra authentication routes to your
routes/web.phpusing the macro:Route::entra(); Route::middleware('MsGraphAuthenticated')->group(function () { // Your authenticated routes here... }
- Perform any additional configuration following the Laravel Microsoft Graph documentation
Usage
Users will automatically be redirected to the Microsoft Azure login page whenever they attempt to access an authenticated route as a guest.
The EntraServiceProvider automatically registers the relevant event listeners for authentication.
You can use the Laravel Microsoft Graph library as normal.
Entra helper
Entra::findUser()
Entra::findUsers()
Entra::importUser()
Rules
UserExistsInEntra
Emulator
Entra::emulate()
Manual sign-in and out
You can allow users to manually login by providing a link to the login route.
Users can logout by calling the logout route.
Entra responses
Sample responses are provided in the tests/Data directory.