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

Add Module bindings to Provider #320

Merged
merged 3 commits into from
Aug 19, 2024
Merged

Conversation

Chemaclass
Copy link
Member

📚 Description

Inspired by Laravel Provider bindings, you can also define global bindings on each module Provider

🔖 Changes

  • Enable defining custom bindings on module Provider level

For example:

final class Provider extends AbstractProvider
{
    /** @var array<class-string,class-string> */
    public array $bindings = [
        GreeterGeneratorInterface::class => CompanyGenerator::class,
    ];

    public function provideModuleDependencies(Container $container): void
    {
    }
}

See test BindingsInsideProvider for a full working example

@Chemaclass Chemaclass added the enhancement New feature or request label Aug 18, 2024
@Chemaclass Chemaclass self-assigned this Aug 18, 2024
@Chemaclass Chemaclass changed the title Add module bindings to setup Add Module bindings to Provider Aug 18, 2024
@Chemaclass Chemaclass merged commit 8155a45 into main Aug 19, 2024
13 checks passed
@Chemaclass Chemaclass deleted the feat/add-provider-bindings branch August 19, 2024 18:05
@Chemaclass
Copy link
Member Author

Feature unstable and removed here 2517070

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants