- What does piotrpolak/codeigniter-symfony2-bridge actually do?
- It is a CodeIgniter library that loads and exposes Symfony2 services inside a CodeIgniter application so both frameworks can share one service container. It acts as a compatibility layer for controllers, libraries and helpers that need Symfony services without rewriting the whole app. It is aimed at legacy or mixed-framework codebases rather than greenfield projects.
- How do I install piotrpolak/codeigniter-symfony2-bridge with Composer?
- Require the package through Composer alongside your existing CodeIgniter and Symfony dependencies. Because it is a bridge rather than a framework, you also need a working CodeIgniter application and the Symfony2 components you intend to expose. Check the repository README for the exact bootstrap and configuration steps.
- Is this package compatible with Laravel?
- No. It targets CodeIgniter applications that need Symfony2 services, not Laravel, which already ships its own service container and dependency injection. If you are building on Laravel you would use Laravel's container directly instead of this bridge.
- Which CodeIgniter and Symfony versions does this bridge support?
- The package was written around Symfony2 components and the CodeIgniter releases of that era, so it does not target Symfony 4 plus or newer framework versions. Always verify the constraints in the composer.json of the version you plan to install. For modern Symfony versions you should expect to adapt the bridge or fork it.
- How does the service container bridge work?
- The library bootstraps a Symfony service container and makes its services reachable from CodeIgniter code, typically through a thin accessor or loader. Your CodeIgniter controllers, libraries and helpers can then pull Symfony services instead of instantiating dependencies themselves. That keeps configuration in the Symfony container while legacy CodeIgniter code stays mostly untouched.
- Can I use this bridge for a gradual migration from CodeIgniter to Symfony?
- Yes, that is the primary use case described for the package. You can move individual concerns into Symfony services while CodeIgniter continues to handle routing and controllers. Over time the ratio shifts until the Symfony side dominates, which keeps the migration incremental instead of a rewrite.
- Can I run Symfony routing next to CodeIgniter routing?
- The bridge is described as covering routing as well as the container and shared libraries, so both can coexist in one application. In practice you usually send some requests through Symfony and let CodeIgniter handle the legacy routes. Test the interaction carefully, since two routers in one app requires a clear dispatch order.
- Can I use Twig, Console, EventDispatcher or other Symfony components inside CodeIgniter?
- The bridge focuses on making Symfony services available to CodeIgniter, so any component you register in the container can be consumed from CodeIgniter code. That includes commonly shared libraries such as templating, events and console tooling. Availability depends on what you wire into the container, not on the bridge itself.
- How should I test an application that uses this bridge?
- Keep container configuration testable by bootstrapping the same container in your test suite and asserting that services resolve correctly. Unit test your CodeIgniter code against interfaces rather than concrete Symfony services. Integration tests that exercise both routing layers are worth having if you split traffic between the two frameworks.
- Is piotrpolak/codeigniter-symfony2-bridge still maintained and safe for production?
- The package is a small, targeted compatibility layer aimed at legacy migrations, so expect limited activity rather than frequent releases. Review the repository history and open issues before adopting it, and pin a version you have tested. For new projects or current Symfony versions, native dependency injection inside a single framework is usually the safer choice.