Download the PHP package agroezinger/filament-shield-enhanced without Composer

On this page you can find all versions of the php package agroezinger/filament-shield-enhanced. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filament-shield-enhanced

Filament Shield Enhanced

[!WARNING] Testing Phase: Versions 0.0.* are currently in the testing phase. At present, there are no known bugs.

A standalone addon for bezhansalleh/filament-shield that adds fine-grained page and resource permissions and a structured Role Resource UI — without forking or replacing the original package.

Why this exists.
The features were proposed upstream in bezhanSalleh/filament-shield#698. The author has not had time to review the PR. This addon ships the same functionality as a composable layer on top of the official package.


Features

Feature Description
Multi-action page permissions Declare several permissions per page via getShieldPagePermissions().
Multi-action resource permissions Declare custom permissions per resource via getShieldResourcePermissions() — beyond the standard CRUD policy methods.
canShield('action') Fluent, type-safe permission check — instance method on Pages, static method on Resources.
getShieldPermissions() Returns a pre-resolved action → bool map for injection into child Livewire components.
HasInjectedShieldPermissions Trait for child Livewire components that receive the map from the parent page.
EnhancedPagePermissionsForm Form builder helper for the published RoleResource — renders each enhanced page as a separate Section with individual checkboxes.
EnhancedResourcePermissionsForm Form builder helper for the published RoleResource — renders each enhanced resource as a separate Section with individual checkboxes.
Three-part page key convention {Prefix}{sep}{Action}{sep}{Subject} (e.g. Page:EditSettings:SettingsPage) — fully respects filament-shield's separator and case config.
Two-part resource key convention {Action}{sep}{ModelBasename} (e.g. ViewContactInfo:Member) — matches Shield's own resource permission format, no extra prefix.
Zero conflict Does not replace any original class. Falls back gracefully on entities that do not declare the method.

Requirements

Dependency Version
PHP ^8.2
Laravel ^11.0 | ^12.0 | ^13.0
Filament ^4.0 | ^5.0
bezhansalleh/filament-shield ^4.0

Installation

Publish the config (optional):


Usage — Pages

1 — Declare fine-grained permissions on a Page

Replace (or complement) the original HasPageShield with the enhanced version:

Then run the enhanced generator to create the permissions in the database:

Use --panel=<id> to limit the scan to a single panel.

This will create three permissions for the page above:


2 — Check permissions in PHP (Pages)


3 — Inject permissions into child Livewire components

Parent page Blade:

Child Livewire component:


Usage — Resources

4 — Declare fine-grained permissions on a Resource

Add HasResourceShield to any Filament Resource and declare custom actions via getShieldResourcePermissions():

Then create the permissions in the database:

This will create (for the example above):

The key format (Action:ModelBasename) is identical to Shield's own resource permission format so everything looks consistent.


5 — Check resource permissions in PHP

canShield() is a static method on Resources (unlike Pages, where it is an instance method):

Super-admin bypass is applied automatically — identical behaviour to the page trait.


6 — Structured UI in the published RoleResource

After publishing the RoleResource with php artisan shield:publish --panel=<id> two files need small changes.

6a — RoleResource: add both enhanced tabs

Open the published RoleResource.php and override two methods:

Each Resource that declares getShieldResourcePermissions() appears in the "Resources (Fine-grained)" tab as its own Section with individual checkboxes.

Note: Shield's standard "Resources" tab only shows CRUD policy method permissions (ViewAny, Create, Update, …). Custom resource actions do not appear there — no duplicate-filtering override is needed.

6b — EditRole: add the pre-fill trait

Open the published EditRole.php and add use HasEnhancedRoleForm. This pre-fills both page- and resource-permission checkboxes when the form opens.

The mutateFormDataBeforeSave() / afterSave() logic from Shield's own EditRole handles saving — no additional overrides needed.


Configuration


How it works internally

This addon does not override any class from filament-shield. Instead it uses the package's public extension point:

When a Page class exposes getShieldPagePermissions(), the addon intercepts the key builder and applies its three-part naming convention. All other entities (Resources, Widgets, regular Pages) are delegated back to the original builder unchanged.

Resource permissions use a two-part format matching Shield's own convention and are not created via shield:generate — only via shield:generate-enhanced-resources. This means the hook is not involved for Resources at all.


Upgrading from the fork

If you previously used the agroezinger/filament-shield fork (which is a modified copy of the original package):

  1. Switch composer.json back to the official package:

  2. Replace use BezhanSalleh\FilamentShield\Traits\HasPageShield with
    use Agroezinger\FilamentShieldEnhanced\Traits\HasPageShield in your pages.
  3. Replace use BezhanSalleh\FilamentShield\Traits\HasInjectedShieldPermissions (if used) with
    use Agroezinger\FilamentShieldEnhanced\Traits\HasInjectedShieldPermissions.
  4. Re-run php artisan shield:generate --all so the new three-part keys are created.

Changelog

See CHANGELOG.md.

License

MIT — see LICENSE.md.

Credits


All versions of filament-shield-enhanced with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
bezhansalleh/filament-shield Version 4.2.0
filament/filament Version ^4.0|^5.0
illuminate/contracts Version ^11.28|^12.0|^13.0
illuminate/support Version ^11.28|^12.0|^13.0
spatie/laravel-package-tools Version ^1.92
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package agroezinger/filament-shield-enhanced contains the following files

Loading the files please wait ...