8000 [3.x] Define services in more convenient and readable way by voronkovich · Pull Request #59 · joomla-framework/di · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[3.x] Define services in more convenient and readable way #59

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

Open
wants to merge 1 commit into
base: 3.x-dev
Choose a base branch
from

Conversation

voronkovich
Copy link
Contributor
@voronkovich voronkovich commented Mar 6, 2025

Summary of Changes

This PR introduces a new container method def() which returns a special resource builder allowing to configure service in a more convenient way using fluent interface:

$container->def(CacheControllerFactoryInterface::class)
    ->shared()
    ->protected()
    ->lazy(CacheControllerFactory::class)
    ->factory(
        function (Container $container) {
            return new CacheControllerFactory();
        },
    )
    ->aliases([ 'cache.controller.factory', CacheControllerFactory::class ])
    ->tags([ 'cache_controller' ])
    ->end();

Testing Instructions

Unit tests provided

Documentation Changes Required

Yes

@voronkovich voronkovich changed the title Define services in more convenient and readable way [3.x] Define services in more convenient and readable way Mar 13, 2025
@voronkovich voronkovich force-pushed the service-definition branch 3 times, most recently from a18b519 to 473a3b7 Compare May 9, 2025 14:35
@voronkovich voronkovich force-pushed the service-definition branch from 473a3b7 to 82655d1 Compare May 9, 2025 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0