Maravel Framework 10.60
maravel-framework 10.60 avoids run-time reflection on method auto-wire to speed up the boot process.
By default it will precompile at deploy time the method’s definitions from the registered Service Providers (boot method only) and from the used Controllers in the route definitions. Besides those it will also include by default (but it can also be configured in config/app.php):
/**
* artisan autowiring::cache source paths for public methods (except __construct).
* The Controllers and Service providers are handled automatically
*/
'autowiring' => [
[
'path' => \app()->path() . DIRECTORY_SEPARATOR . 'Console' . DIRECTORY_SEPARATOR . 'Commands',
'methods' => ['handle', '__invoke'],
],
[
'path' => \app()->path() . DIRECTORY_SEPARATOR . 'Jobs',
'methods' => ['handle', '__invoke'],
],
[
'path' => \app()->path() . DIRECTORY_SEPARATOR . 'Http' . DIRECTORY_SEPARATOR . 'Requests',
'methods' => ['validator', 'authorize', 'after', 'rules'],
],
],
Usage:
php artisan autowiring:cache
php artisan autowiring:clear
Maravel Micro-Framework, now includes events as observers.
php artisan event:cache
php artisan event:clear
To auto-discover them, override in EventServiceProvider these methods but only when event:cache is ran on deploy:
/**
* Determine if events and listeners should be automatically discovered.
*/
public function shouldDiscoverEvents(): bool
{
return true;
}
/**
* Determine if events as observers and listeners should be automatically discovered.
*/
public function shouldDiscoverEventsAsObservers(): bool
{
return true;
}
Note:
Both Maravelith and Maravel templates can take advantage of these improvements.
This will not include the __construct methods because those are handled in a different way.
