Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support string variables in container configuration for factory functions #178

Merged
merged 4 commits into from
Jul 29, 2022

Conversation

clue
Copy link
Owner

@clue clue commented Jul 27, 2022

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

<?php

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

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

// …

This is a first step in adding support for environment variables and .env (dotenv) files as discussed in #101.

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

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