1

So I'm getting to a point where I have a lot of services in a particular plugin, and I would like to organize my plugin services into sub-folders. I've tried a couple ways but the controllers don't seem to be able to find the appropriate services unless they are in the main services directory. I know I can put controller files in sub-folders of the controllers folder, so I thought the same would be true for services. Does Craft support what I'm trying to do?

1 Answer 1

2

Craft will only look in the immediate pluginHandle/services folder when auto-loading and registering a plugin's service files.

If you wanted to support services in subfolders (i.e. pluginhandle/services/subfolder1, etc.), you'd have to manually autoload and register those classes yourself from your plugin's init() method.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.