spiral / framework

High-Performance PHP Framework
https://spiral.dev
MIT License
1.8k stars 87 forks source link

[spiral/boot] Adding `BootloaderRegistry` to improve the bootloader registration process #1015

Closed msmakouz closed 10 months ago

msmakouz commented 10 months ago
Q A
Bugfix?
Breaks BC?
New feature? ✔️

What was changed

Added the Spiral\Boot\Bootloader\BootloaderRegistryInterface interface and the implementation Spiral\Boot\Bootloader\BootloaderRegistry to streamline the bootloader registration process. This change allows for a more efficient and flexible bootloader registration mechanism within the Spiral Framework.

Customization

In situations where customization is needed, you have the option to create your own implementation of the BootloaderRegistryInterface:

  1. Create a new class that implements the Spiral\Boot\Bootloader\BootloaderRegistryInterface. Let's call it CustomBootloaderRegistry in this example.

  2. Instantiate a container in your app.php.

  3. Register your custom implementation in the container:


// app.php
$container = new \Spiral\Core\Container();
$container->bindSingleton(
    \Spiral\Boot\Bootloader\BootloaderRegistryInterface::class,
    CustomBootloaderRegistry::class
);

$app = Kernel::create(
    directories: ['root' => __DIR__],
    container: $container
)->run();
codecov[bot] commented 10 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (85aa4bb) 89.15% compared to head (9b1b16e) 89.19%. Report is 2 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1015 +/- ## ============================================ + Coverage 89.15% 89.19% +0.03% - Complexity 6124 6138 +14 ============================================ Files 812 809 -3 Lines 17312 17338 +26 ============================================ + Hits 15434 15464 +30 + Misses 1878 1874 -4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.