panlatent / craft-attribute
Attribute for CraftCMS
Installs: 1
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/panlatent/craft-attribute
Requires
- php: >=8.2
- craftcms/cms: ^5.0
This package is auto-updated.
Last update: 2025-09-15 08:05:46 UTC
README
Using PHP Attribute in CraftCMS.
Installation
Then tell Composer to load the library:
composer require panlatent/craft-attribute
Usages
Controllers
For Web Controllers, you can inherit panlatent\craft\attribute\web\Controller
or use Trait panlatent\craft\attribute\web\HasAttributes
to use these attributes:
Attribute | Targets | Scopes |
---|---|---|
#[AllowAnonymous] | Controller | Class |
#[RequireLogin] | ControllerAction | Method |
#[RequirePostRequest] | ControllerAction | Method |
#[RequireAcceptsJson] | ControllerAction | Method |
Elements
Documentation
License
The Element Messages is open-sourced software licensed under the MIT license.