Skip to content

Conversation

@clue
Copy link
Owner

@clue clue commented Jul 23, 2022

This changeset adds support for loading the AccessLogHandler and ErrorHandler from the Container. They can now be given explicitly to the App like this:

<?php

require __DIR__ . '/../vendor/autoload.php';

$app = new FrameworkX\App(
    FrameworkX\AccessLogHandler::class,
    FrameworkX\ErrorHandler::class
);

// Register routes here, see routing…

$app->run();

On top of this, you may now configure the default handlers with an explicit DI container configuration like this:

<?php

require __DIR__ . '/../vendor/autoload.php';

$container = new FrameworkX\Container([
    FrameworkX\AccessLogHandler::class => fn () => new FrameworkX\AccessLogHandler(),
    FrameworkX\ErrorHandler::class => fn () => new FrameworkX\ErrorHandler()
]);

$app = new FrameworkX\App($container);

// Register routes here, see routing…

$app->run();

This is the next step in adding more options to control access logging and error handling in follow-up PRs as discussed in #169 and #170.

Builds on top of #173 and #174

@clue clue added the new feature New feature or request label Jul 23, 2022
@clue clue requested a review from SimonFrings July 23, 2022 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants