Developer documentation for the lightweight, PHP-FPM-oriented Bhitti framework.
Bhitti’s container provides constructor autowiring, explicit bindings, singletons, instances, and runtime constructor parameters without a service-provider hierarchy.
$service = $container->make(ReportService::class);
Concrete constructor dependencies are resolved recursively.
$container->bind(
MailerInterface::class,
SmtpMailer::class
);
$container->singleton(
Metrics::class,
Metrics::class
);
$container->instance(
ClockInterface::class,
$clock
);
Middleware and other runtime-created services can receive explicit constructor values through makeWith():
$middleware = $container->makeWith(
RoleMiddleware::class,
['admin']
);
Named parameters are also supported where they match constructor parameter names.
Application-level singleton registrations live in config/container.php.
Bhitti caches reflection metadata and detects circular dependency chains. Interfaces/abstract types must be bound unless a nullable/default constructor parameter lets the container omit them.
Union/intersection constructor types are intentionally not treated as automatic class dependencies; bind or provide those values explicitly.