Search code examples
phpexceptionfile-organization

Files organization: Where should exception extended classes be placed?


Let's say we have several exception classes that extends exception. My question is, in order to proper organize our files, where should those classes be placed ?

i.e - Are they helper classes?

One on it's on file? Ok. Respecting naming conventions. Ok.

But then we group those files and in what folder should we put them? On a folder called Helper Classes?

You can named as you like, I realise that, I'm just trying to figure it out, if there is any rational about the place where we can put those classes.

Thanks in advance, MEM


Solution

  • That depends how you use them. THe safest way is to keep each exception in its own file (this will enable use of spl_autoload().