Bridge for using Slim with ExpressionEngine
This is probably only of interest to me, but you're welcome to use this project if you come across it and like it.
I really like working in Slim, with FastRoute, and PSR standard interfaces. To that end, I've created this extremely simple ExpressionEngine Extension that let's me do the front-end of EE sites in Slim and mostly ignore that EE is there in the background.
Since you're wanting to use Slim and PHP and PSR interfaces, it is assumed that you already have composer setup and are loading the vendor autoload.
- In your craft project, run
composer require buzzingpixel/ee-slim-bridge
- Symlink or Docker mount or what ever you want to use
- Install the extension in the ExpressionEngine control panel
- Set up the configuration in your ExpressionEngine config file based on the examples in the [next section]((#config).
In your config file, all configuration goes in an array key named
Three keys are available in the config file (See example):
If this is not set to
(string) '1', or
(int) 1, then Slim Bridge will not serve the front-end via Slim. This could be theoretically useful if you want to do some logic or other to determine whether a request should be sent to Slim or let ExpressionEngine serve the request as normal.
Slim requires an implementation of
\Psr\Container\ContainerInterface and I've left this to project owners to provide. I've written what I think is a pretty good container implementation, and it is required as part of the project for internal use, so you could certainly configure and return an instance of that container.
This is optional, but if you don't use it, then you won't have set any routes or middlewares and it will be useless to you. Once the app has been created, this callback will be run and the argument received will be the Slim App instance which you can use to set routes and middleware.