Skip to content

Commit

Permalink
feat: make dependency injection ✨
Browse files Browse the repository at this point in the history
  • Loading branch information
thiiagoms committed Jun 13, 2023
1 parent 908bbed commit 07f9fac
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

if (php_sapi_name() != 'cli') {
die("<h1>Only in CLI mode </h1>");
}

use MementoMori\Commands\MementoMoriCommand;
use MementoMori\Services\MementoMoriService;
use MementoMori\Helpers\ContainerDI;

require_once __DIR__ . '/autoload.php';

$container = new ContainerDI();

$container->add('MementoMoriService',fn(): object => new MementoMoriService());
$container->add('MementoMoriCommand', fn(object $container): object => new MementoMoriCommand(
$container->get('MementoMoriService')
));

$app = $container->get('MementoMoriCommand');

0 comments on commit 07f9fac

Please sign in to comment.