code16/sharp
Sharp is a Laravel 11+ (PHP 8.3+) content management framework for building a CMS/admin area with a clean UI and great DX. Code-driven, data-agnostic, no frontend to write. Manage structured data with search, filters, commands, auth, and validation.
Sharp provides a built-in solution to manage and authenticate with passkeys. Passkeys are a replacement for passwords that provide faster, easier, and more secure sign-ins to websites and apps across a user’s devices.
Passkeys in Sharp requires the spatie/laravel-passkeys package.
Follow the installation instructions of the package (the JavaScript installation part is not needed for Sharp).
To enable passkeys in Sharp, use the enablePasskeys() method in your SharpServiceProvider:
class SharpServiceProvider extends SharpAppServiceProvider
{
protected function configureSharp(SharpConfigBuilder $config): void
{
$config
->enablePasskeys()
// [...]
}
}
By default, Sharp will prompt the user to create a passkey after a successful password-based login if they don't have one yet. You can disable this feature like this :
$config->enablePasskeys(promptAfterLogin: false);
Once enabled, Sharp automatically registers a PasskeyEntity that you can use in your application. A common use case is to allow users to manage their passkeys from their profile page using a SharpShowEntityListField.
Here is an example of how to add the passkey management list to a ProfileSingleShow:
use Code16\Sharp\Auth\Passkeys\Entity\PasskeyEntity;
use Code16\Sharp\Show\Fields\SharpShowEntityListField;
// ...
class ProfileSingleShow extends SharpSingleShow
{
protected function buildShowFields(FieldsContainer $showFields): void
{
$showFields
// [...]
->addField(
SharpShowEntityListField::make(PasskeyEntity::class)
->setLabel('Passkeys')
);
}
protected function buildShowLayout(ShowLayout $showLayout): void
{
$showLayout
->addSection('', function (ShowLayoutSection $section) {
// [...]
})
->addEntityListSection(PasskeyEntity::class);
}
// ...
}
How can I help you explore Laravel packages today?