New to the slim framework (difference bewteen the src and app folders?)


I have been looking into a lot of slim example projects on GitHub, and i see both folders being used.
And i don’t get to understand what the differences should be.

In my opinion the src folder should be used to add commonly used files like base classes etc.
And the app folder is mend for the working controllers/models/routers etc.

Sadly in most cases i dont see that break-up of logic.

Before i start creating my own i love to know what are you troughs about this?

Hello @Niels

Please read this about the Standard PHP package skeleton first.

IMHO the app/ directory is “outdated”, please use the src/ directory for all your application specific PHP classes. The src/ directory should be your App namespace too.

Put your configuration files into the config/ directory. For example settings.php, routes.php, middleware.php and so on…

Put your static assets (js, css, fonts etc) and the Slim frontend controller (index.php) into the public/ directory.

All unit tests should be placed into the tests/ directory. (Namespace: App\Test)

1 Like

I use app/ for no other reasons than it comes first alphabetically when listing the contents of the project thus quicker to find, and matches the namespace.