uzbek / laravel-attribute-scanner
PHP8 Attribute scanner for Laravel project
Installs: 1 007
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 4
Requires
- php: ^8.1
- illuminate/contracts: ^9.0|^10.0
- spatie/laravel-package-tools: ^1.13.0
Requires (Dev)
- laravel/pint: ^1.0|^2.0
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- dev-main
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- 0.0.1
- dev-dependabot/github_actions/stefanzweifel/git-auto-commit-action-5
- dev-dependabot/github_actions/actions/checkout-4
- dev-dependabot/github_actions/aglipanci/laravel-pint-action-2.3.0
- dev-dependabot/github_actions/ramsey/composer-install-2
This package is auto-updated.
Last update: 2024-12-09 08:25:29 UTC
README
PHP8 Attribute scanner for Laravel project
Installation
You can install the package via composer:
composer require uzbek/laravel-attribute-scanner
Usage
use Uzbek\LaravelAttributeScanner\Facades\AttributeScanner; $attributes = AttributeScanner::getAttributes(asArray: true); // or use Uzbek\LaravelAttributeScanner\LaravelAttributeScanner; $scanner = new LaravelAttributeScanner(directories: ['app/Models', 'app/Http/Controllers']); $attributes = $scanner->getAttributes();
Result examples
asArray = false (default)
[ "App\Http\Controllers\UserController@create" => [{...},{...}], #Uzbek\LaravelAttributeScanner\Attribute[], (method) "App\Http\Controllers\UserController@update>id" => [{...}], #Uzbek\LaravelAttributeScanner\Attribute[], (parameter) "App\Http\Controllers\UserController.service" => [{...}], #Uzbek\LaravelAttributeScanner\Attribute[], (property) ]
asArray = true
[ "App\Http\Controllers\UserController@create" => [ [ "class" => "App\Http\Controllers\UserController", "method" => "create", "target" => "method", "name" => "Uzbek\LaravelValidationAttributes\Attributes\Validators", "arguments" => [ [ "name" => "required|string", "email" => "required|email", ... ], ], ] ], "App\Http\Controllers\UserController@update>id" => [ [ "class" => "App\Http\Controllers\UserController", "method" => "update", "target" => "parameter", "parameter" => "id", "name" => "Uzbek\SomeAttributes\ID", "arguments" => [], ] ], "App\Http\Controllers\UserController.service" => [ [ "class" => "App\Http\Controllers\UserController", "target" => "property", "property" => "service", "name" => "Uzbek\SomeAttributes\Readonly", "arguments" => [], ] ], "App\Http\Controllers\UserController:IS_PUBLIC" => [ [ "class" => "App\Http\Controllers\UserController", "target" => "constant", "constant" => "IS_PUBLIC", "name" => "Uzbek\SomeAttributes\Casts\Integer", "arguments" => [], ] ], ... ]
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.