Skip to content

Conversation

@clue
Copy link
Owner

@clue clue commented Jul 29, 2022

This changeset adds support for scalar variables in the container configuration for all factory functions:

<?php

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

$container = new FrameworkX\Container([
    Acme\Todo\UserController::class => function (bool $debug, string $hostname) {
        // example UserController class requires two scalar arguments
        return new Acme\Todo\UserController($debug, $hostname);
    },
    'debug' => false,
    'hostname' => fn(): string => gethostname()
]);

// …

The previous version only supported string values, we now support all scalar values (string, int, float, bool). This is the next step in adding better configuration support and support for environment variables and .env (dotenv) files as discussed in #101.

Builds on top of #178, #163, #97, #95 and others

@clue clue added the new feature New feature or request label Jul 29, 2022
@clue clue requested a review from SimonFrings July 29, 2022 07:37
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