Skip to content

Conversation

@clue
Copy link
Owner

@clue clue commented Dec 7, 2021

This changeset exposes the Container API to allow explicit DI container configuration. This allows us to fine-tune the autowiring behavior and explicitly overwrite autowiring defaults for more advanced use cases. This does not otherwise break existing APIs, so this is a pure feature addition.

<?php

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

$container = new FrameworkX\Container([
    Acme\Todo\HelloController::class => fn() => new Acme\Todo\HelloController();
]);

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

$app->get('/', Acme\Todo\HelloController::class);
$app->get('/users/{name}', Acme\Todo\UserController::class);

$app->run();

PSR-11 compatibility is on the roadmap, but left up for a follow-up PR.

Builds on top of #94 and #92

@clue clue added the new feature New feature or request label Dec 7, 2021
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