Last active
November 23, 2025 19:18
-
-
Save ghostwriter/215a2ca3c6d1b448185ce876385b1bb0 to your computer and use it in GitHub Desktop.
Configuration Extension for ghostwriter/container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "extra": { | |
| "ghostwriter": { | |
| "container": { | |
| "definition": "Ghostwriter\\Wip\\Container\\WipDefinition" | |
| } | |
| } | |
| }, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(strict_types=1); | |
| namespace Ghostwriter\Wip\Container\Ghostwriter\Config; | |
| use Ghostwriter\Config\Configuration; | |
| use Ghostwriter\Config\Interface\ConfigurationInterface; | |
| use Ghostwriter\Container\Interface\ContainerInterface; | |
| use Ghostwriter\Container\Interface\Service\ExtensionInterface; | |
| use Override; | |
| use Throwable; | |
| use const DIRECTORY_SEPARATOR; | |
| use function dirname; | |
| use function implode; | |
| /** | |
| * @see ConfigurationExtensionTest | |
| * | |
| * @implements ExtensionInterface<ConfigurationInterface> | |
| */ | |
| final readonly class ConfigurationExtension implements ExtensionInterface | |
| { | |
| /** | |
| * @param ConfigurationInterface $service | |
| * | |
| * @throws Throwable | |
| */ | |
| #[Override] | |
| public function __invoke(ContainerInterface $container, object $service): void | |
| { | |
| $configuration = Configuration::new(); | |
| $configuration->mergeDirectory(implode(DIRECTORY_SEPARATOR, [dirname(__DIR__, 4), 'config'])); | |
| $service->set(self::class, $configuration->toArray()); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(strict_types=1); | |
| use Symfony\Component\Console\Command\Command; | |
| /** | |
| * @return array{ | |
| * name: string, | |
| * package: string, | |
| * auto_exit: bool, | |
| * single_command: bool, | |
| * default_command: string, | |
| * catch_errors: bool, | |
| * catch_exceptions: bool, | |
| * commands: class-string<Command> | |
| * } | |
| */ | |
| return [ | |
| 'name' => 'wip', | |
| 'package' => 'ghostwriter/wip', | |
| 'auto_exit' => false, | |
| 'single_command' => false, | |
| 'default_command' => 'list', | |
| 'catch_errors' => true, | |
| 'catch_exceptions' => true, | |
| 'commands' => [], | |
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(strict_types=1); | |
| use Ghostwriter\Container\Interface\Service\DefinitionInterface; | |
| use Ghostwriter\Container\Interface\Service\ExtensionInterface; | |
| use Ghostwriter\Container\Interface\Service\FactoryInterface; | |
| /** | |
| * @return array{ | |
| * 'alias': array<class-string,class-string>, | |
| * 'define': array<class-string,class-string<DefinitionInterface>>, | |
| * 'extend': array<class-string,list<class-string<ExtensionInterface>>>, | |
| * 'factory': array<class-string,class-string<FactoryInterface>> | |
| * } | |
| */ | |
| return [ | |
| 'alias' => [], | |
| 'define' => [], | |
| 'extend' => [], | |
| 'factory' => [], | |
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(strict_types=1); | |
| /** | |
| * @return array{ | |
| * 'listen': array<'object'|class-string,list<class-string>> | |
| * } | |
| */ | |
| return [ | |
| 'listen' => [ | |
| 'object' => [], | |
| // Event::class => [Listener::class], | |
| ], | |
| ]; |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ghostwriter make:extension Applicationghostwriter make:extension Configurationghostwriter make:extension ListenerProviderghostwriter make:config ghostwriter/consoleghostwriter make:config ghostwriter/containerghostwriter make:config ghostwriter/event-dispatcherghostwriter make:definition Packageghostwriter make:event Eventghostwriter make:factory Serviceghostwriter make:listener Listenerghostwriter make:command RunCommandghostwriter ecs:initghostwriter rector:init