-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Registration of dumper middleware, add http module (#135)
- Loading branch information
Showing
19 changed files
with
142 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Installer\Module\Dumper\Generator; | ||
|
||
use Installer\Internal\Generator\Context; | ||
use Installer\Internal\Generator\GeneratorInterface; | ||
use Installer\Module\Http\Package; | ||
use Spiral\Debug\Middleware\DumperMiddleware; | ||
use Spiral\Http\Middleware\ErrorHandlerMiddleware; | ||
|
||
final class Middlewares implements GeneratorInterface | ||
{ | ||
public function process(Context $context): void | ||
{ | ||
if (!$context->application->isPackageInstalled(new Package())) { | ||
return; | ||
} | ||
|
||
$context->routesBootloader?->addUse(DumperMiddleware::class); | ||
|
||
$context->routesBootloader?->addGlobalMiddleware( | ||
middleware: [DumperMiddleware::class], | ||
afterMiddleware: ErrorHandlerMiddleware::class | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Installer\Module\Http\Generator; | ||
|
||
use Installer\Internal\Generator\Context; | ||
use Installer\Internal\Generator\GeneratorInterface; | ||
use Spiral\Bootloader\Http\HttpBootloader; | ||
|
||
final class Bootloaders implements GeneratorInterface | ||
{ | ||
public function process(Context $context): void | ||
{ | ||
$context->kernel->addUse(HttpBootloader::class); | ||
|
||
$context->kernel->load->addGroup( | ||
bootloaders: [ | ||
HttpBootloader::class, | ||
], | ||
comment: 'HTTP extensions', | ||
priority: 6 | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Installer\Module\Http; | ||
|
||
use Installer\Application\ComposerPackages; | ||
use Installer\Internal\Package as BasePackage; | ||
use Installer\Module\Http\Generator\Bootloaders; | ||
|
||
final class Package extends BasePackage | ||
{ | ||
public function __construct() | ||
{ | ||
parent::__construct( | ||
package: ComposerPackages::Http, | ||
generators: [ | ||
new Bootloaders(), | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Module; | ||
|
||
use Installer\Internal\Application\ApplicationInterface; | ||
use Installer\Module\Http\Package; | ||
use Spiral\Bootloader\Http\HttpBootloader; | ||
|
||
final class Http extends AbstractModule | ||
{ | ||
public function __construct() | ||
{ | ||
parent::__construct(new Package()); | ||
} | ||
|
||
public function getBootloaders(ApplicationInterface $application): array | ||
{ | ||
return [ | ||
HttpBootloader::class, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters