I am seeing, there are a number of library got included in vendor folder (screen shot is given below).
I know some of them are cool, but why a few of them are are there? like
Nikic Route : SLIM already have powerful routing system then why this one?
Doctrine : I m not interested in using Doctrine, I would like propel or Eloquent then why this is sitting there; may be because of monolog.
ContainerInterop : I am sorry, really don’t know about this.
Symfony/yaml : I hate everything from symfony and so yaml. Symfony exaggerate things … If I have to deal with complexity only, then why not I will choose JAVA instead of symfony or php? sorry for my rant.
However, some of them are good like Webmozart , PHPUnit. I think sample application should be lean and minimalist to match with the USP of SLIM.
Could anybody please tell me why Nikic Route in sample SLIM app? This is what infuriating me.
You are of course free to use any additional packages you wish, and exclude those you don’t wish to use. For any installed package, you can use composer why vendor_name/package_name to get information about which other package required it. Remember, just because the package is sitting there doesn’t mean the code is being run or that you must use it.
As for some of your specific questions, yes, Slim has a powerful routing system, which is based on nikic/fast-route. Running composer why doctrine/instantiator will tell you that there are two packages phpspec/prophecy and phpunit/phpunit-mock-objects that require it. Container-interop is required by the Slim Framework itself and is in place so that you can swap out and use whichever dependency injection container you desire, if you don’t like the default (Pimple) that ships with Slim. The symfony/yaml component is required by PHPUnit.
The takeaway here is that packages have features they desire to support, and some of those features require other packages to work. If you don’t use all of those features that is fine, your code will not run them, but Composer can’t determine what you will and won’t use for features so it installs all of the packages each package says is required.
Thank you very much @akrabat for detailed explanation. It really helped me to understand many things. I was thinking ROUTE is internal component of SLIM and Nikic Routes is added on the top of that default router. It was my fault.
Thanks @tflight. I got your point. I was totally wrong. Actually, long ago, I used Slim(perhaps SLIM 1) and I have some pre-conceived notion about SLIM. SLIM 3 has changed a lot. Thanks for your answer it really helped me.