set(ServiceInterface::class, fn($c) => new ConcreteService()); * * @param Framework\Container $container */ use Framework\Container; use Infrastructure\Persistence\Connection; return function (Container $container): void { // Database connection (singleton) $container->set(\PDO::class, function () { return Connection::getInstance(); }); // Example: Register interface to implementation mappings // $container->set(TaskRepositoryInterface::class, fn($c) => // $c->get(TaskRepository::class) // ); // Note: Most services don't need explicit registration. // The container will autowire them automatically based on // constructor type hints. Only register services that: // - Need specific configuration // - Map interfaces to implementations // - Require complex initialization };