Closed codedokode closed 7 years ago
This Slim-Skeleton project does have settings, routes, middleware, and DI split out into separate files. As a skeleton project, it is merely an example of how you could setup your app, not necessarily what will make the most sense for your own application. It also includes tools like Monolog and PHP-View which many people might not use, but similarly are included because it is an example project.
The base Slim 3 project uses a single index.php file like how you describe and sounds more applicable to what you are looking for.
There's also my empty slim skeleton which works with a single index.php.
Hello.
I remember in Slim 2 we used to write settings and routes inside index.php and now they have moved into separate files like settings.php, routes.php. Is the current approach adopted from some other framework?
I see some disadvantages with it:
I can suggest an alternative approach: we could make a bootstrap file (initializing autoloading, App class, DI container) and index.php with middleware and routes. So the CLI command could just
require
a bootstrap file and get fully configuredApp
object.What do you think about it?