gpanos / laravel-morph-alias-attribute
Register morph aliases for your laravel models using php 8 attributes
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/gpanos/laravel-morph-alias-attribute
Requires
- php: ^8.0
- illuminate/database: ^8.0
- illuminate/support: ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- mockery/mockery: ^1.3
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.3
This package is auto-updated.
Last update: 2025-10-08 23:48:20 UTC
README
Instead of defining custom polymorphic types inside service providers this package offers an alternative way using php 8 attributes.
Inspired by spatie/laravel-route-attributes
Installation
composer require gpanos/laravel-morph-alias-attribute
Usage
To define a morph alias for your model add the MorphAlias
attribute and pass it your alias.
<?php #[MorphAlias('post')] class Post extends Model { ... }