PHP8 Attribute scanner for Laravel project
You can install the package via composer:
composer require uzbek/laravel-attribute-scanner
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();
[
"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)
]
[
"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" => [],
]
],
...
]
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.