It doesn't really matter as long as you make sure to type-hint correctly relative to the current namespace and/or use the fully qualified class name. However, it's best to follow the established conventions of the core or in this case, the plugin you're building on. The Webhooks plugin puts all the default filters in the directory src/filters/
.
I like to put all modules under the \modules\
namespace, with sub-namespaces for each module. For example, for a module that extends the Webhooks plugin, I would use \modules\CustomWebhooks\
as a namespace. So this would result in the following directory structure:
modules
├── CustomWebhooks
│ ├── CustomWebhooksModule.php
│ └── filters
│ └── ArticleFilter.php
And the following fully qualified class names:
CustomWebhooksModule.php
-> \modules\CustomWebhooks\CustomWebhooksModule
ArticleFilter.php
-> \modules\CustomWebhooks\filters\ArticleFilter
Optionally, you can also put the filters
and every other subdirectory into a src
directory inside modules/CustomWebhooks
, this depends on your autoload setup. In this case, the fully qualified class names don't change, but the directory structure looks like this:
modules
├── CustomWebhooks
│ ├── CustomWebhooksModule.php
│ └── src
│ └── filters
│ └── ArticleFilter.php