Download the PHP package little-green-man/earhart without Composer
On this page you can find all versions of the php package little-green-man/earhart. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download little-green-man/earhart
More information about little-green-man/earhart
Files in little-green-man/earhart
Package earhart
Short Description A package to help use PropelAuth with Laravel
License MIT
Homepage https://github.com/little-green-man/earhart
Informations about the package earhart
Earhart
A Laravel package that makes working with PropelAuth easier.
Primarily it helps your app use PropelAuth's OAuth flow to log users in via Socialite, and API integration to retrieve and manage user and organisation data.
Thanks to Laravel News for the artwork.
Features
- Authentication: Socialite integration with easy route controllers for PropelAuth OAuth
- Secure Webhook Handling that drives Events: Verified webhooks fire events you can listen for in your application when e.g. user details change at PropelAuth
- API Integration: Built-in PropelAuth API client for querying data and to build functionality into your app seamlessly.
- Configuration: Flexible webhook configuration with cache invalidation rules (v1.4+)
Installation
1. Install the package via composer:
2. Configure PropelAuth
In your PropelAuth dashboard:
- Configure general settings (e.g. password requirements)
- Enable these User properties (default settings are fine):
- Name
- Profile Picture
- Terms of Service
- Configure organisation settings as needed
- Set webhook URLs: Integration > Svix > tick all events and set test and prod URLs to
https://{your_app_url}/auth/webhooks
3. Set environment variables:
4. Configure services
Add PropelAuth configuration to config/services.php:
Optionally, publish Earhart's config file to customise caching and other settings:
This creates config/earhart.php where you can customise default values.
5. Update your database
Add these fields to your User model/migration:
propel_id(string)propel_access_token(string)propel_refresh_token(string)avatar(string)data(json)- Make
passwordnullable or remove it - Add any organisation/team models and relations you need
6. Add authentication routes
Add the webhook route to routes/web.php:
Add the OAuth callback and logout routes to routes/web.php:
7. Register the Socialite provider
Add this to the boot method of your AppServiceProvider:
8. Add authentication links to your views:
Optionally, add links to PropelAuth's hosted pages:
Alternatively, implement these features in your own application using Earhart's API integrations.
Refreshing User Tokens
PropelAuth access tokens expire after 30 minutes. To keep user tokens fresh and prevent authentication failures, you should set up a scheduled job to refresh them automatically.
See docs/REFRESHING_USER_TOKENS.md for implementation details.
Registered Routes
The following routes are registered automatically:
auth.redirect- Redirect to PropelAuth loginauth.account- PropelAuth account managerauth.settings- Account settings (requires org_id query parameter)auth.org.create- Create new organizationauth.org.members- Organization members (requires org_id query parameter)auth.org.settings- Organization settings (requires org_id query parameter)
Webhook Events
Create listeners in your application for these events:
Organization Events
LittleGreenMan\Earhart\Events\PropelAuth\OrgCreated- Organization createdLittleGreenMan\Earhart\Events\PropelAuth\OrgDeleted- Organization deletedLittleGreenMan\Earhart\Events\PropelAuth\OrgUpdated- Organization updatedLittleGreenMan\Earhart\Events\PropelAuth\OrgApiKeyDeleted- Organization API key deletedLittleGreenMan\Earhart\Events\PropelAuth\OrgSamlRemoved- SAML connection removedLittleGreenMan\Earhart\Events\PropelAuth\OrgSamlSetup- SAML setup initiatedLittleGreenMan\Earhart\Events\PropelAuth\OrgSamlWentLive- SAML connection went liveLittleGreenMan\Earhart\Events\PropelAuth\OrgScimGroupCreated- SCIM group createdLittleGreenMan\Earhart\Events\PropelAuth\OrgScimGroupDeleted- SCIM group deletedLittleGreenMan\Earhart\Events\PropelAuth\OrgScimGroupUpdated- SCIM group updatedLittleGreenMan\Earhart\Events\PropelAuth\OrgScimKeyCreated- SCIM key createdLittleGreenMan\Earhart\Events\PropelAuth\OrgScimKeyRevoked- SCIM key revoked
User Events
LittleGreenMan\Earhart\Events\PropelAuth\UserCreated- User createdLittleGreenMan\Earhart\Events\PropelAuth\UserUpdated- User profile updatedLittleGreenMan\Earhart\Events\PropelAuth\UserDeleted- User deletedLittleGreenMan\Earhart\Events\PropelAuth\UserEnabled- User account enabledLittleGreenMan\Earhart\Events\PropelAuth\UserDisabled- User account disabledLittleGreenMan\Earhart\Events\PropelAuth\UserLocked- User account lockedLittleGreenMan\Earhart\Events\PropelAuth\UserAddedToOrg- User added to organizationLittleGreenMan\Earhart\Events\PropelAuth\UserRemovedFromOrg- User removed from organizationLittleGreenMan\Earhart\Events\PropelAuth\UserRoleChangedWithinOrg- User role changed in organizationLittleGreenMan\Earhart\Events\PropelAuth\UserAddedToScimGroup- User added to SCIM groupLittleGreenMan\Earhart\Events\PropelAuth\UserRemovedFromScimGroup- User removed from SCIM groupLittleGreenMan\Earhart\Events\PropelAuth\UserDeletedPersonalApiKey- User deleted personal API keyLittleGreenMan\Earhart\Events\PropelAuth\UserImpersonated- User impersonatedLittleGreenMan\Earhart\Events\PropelAuth\UserInvitedToOrg- User invited to organizationLittleGreenMan\Earhart\Events\PropelAuth\UserLoggedOut- User logged outLittleGreenMan\Earhart\Events\PropelAuth\UserLogin- User logged inLittleGreenMan\Earhart\Events\PropelAuth\UserSendMfaPhoneCode- MFA phone code sent to user
Example Listener
PropelAuth API Usage
Use the PropelAuth API within your application:
See USING_PROPEL_API.md for complete API documentation.
Advanced Webhook Verification
The middleware shown in step 6 provides secure webhook verification out of the box.
For advanced webhook signature verification options (v1.4+), see ADVANCED_WEBHOOK_VERIFICATION.md.
Package Testing
Run the test suite:
Run only webhook tests:
Changelog
Please see CHANGELOG.md for more information on what has changed recently.
Contributing
Please see CONTRIBUTING.md for details.
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of earhart with dependencies
illuminate/contracts Version ^11.0||^12.0
illuminate/support Version ^11.0|^12.0
socialiteproviders/propelauth Version ^4.0
svix/svix Version ^1.81
spatie/laravel-data Version ^4.18