Laravel Ninja Keys adds a keyboard-first Cmd+K / Ctrl+K command palette to a Laravel app. You define the actions in PHP and render the ninja-keys web component [2] with one Blade tag. It works with Blade, Livewire and Alpine.
The problem
Using ninja-keys by hand means a script in every layout, an action list built in JavaScript, and remembering which actions each user may see. The package handles those parts.
How it works
Register actions with a fluent builder, using route() or href() so navigation needs no JavaScript.
Render the palette with before .
define() callbacks run at render time, so they can use the logged-in user and current route.
NinjaKeys :: define ( function ( Manager $palette ) { $palette -> addAction ( 'users' ) -> title ( 'Manage users' ) -> route ( 'users.index' ) -> can ( 'manage-users' ) ; } ) ;
Enter fullscreen mode
Exit fullscreen mode
Permission-aware
can() runs your Gate abilities [1] on the server.…