Sharing services safely in Phalcon's DI container
Register stateless Phalcon services as shared DI instances, and avoid storing request-specific state in them.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Register stateless Phalcon services as shared DI instances, and avoid storing request-specific state in them.
Blazor Server's circuit-scoped DI isolates per-user state—but only if you register services correctly, monitor circuit health, and verify disposal. Covers minimal design, trust boundaries, operational checks, and failure modes to prevent state leaks.
A singleton service that stores the current request ID leaks state across concurrent requests. Use Scope.REQUEST only for genuinely request-bound state, and keep shared services singleton.
An architecture note on using Laminas ServiceManager as a composition root: defining trust boundaries between modules, operational guards for predictable object graphs, and failure modes that change the design.
Use IHttpClientFactory to pool HttpMessageHandler instances, avoid socket exhaustion, and respect DNS changes. Register named or typed clients in Program.cs, inject the factory or typed interface, and tune handler lifetime for your deployment environment.
Choose between hand-written factories and ReflectionBasedAbstractFactory for Laminas service wiring, with config examples and validation steps.
Phalcon's DI container offers lazy loading, shared/non-shared services, and PSR-11 support. FactoryDefault pre-registers ~30 services, which can bloat micro-apps and obscure dependencies. Learn registration modes, wiring with named parameters, and why constructor injection belongs in domain code.
A diagnostic guide for Phalcon 4.x/5.x dependency injection issues caused by non-shared services, with ordered checks, fixes, and escalation criteria.
Use Angular Material MatDialog with MAT_DIALOG_DATA to build reusable, data-driven modal dialogs without duplicating markup.