Thanks for replying, I did a composer install and it created an auto-load file, but I didn’t do anything else, I was under the impression because Twilio is listed under require it gets auto-included (maybe that’s my issue).
Here is my composer.json (I’ve removed the company name and changed to myplugin)
There is another autoload inside vendor/twilio/src/autoload.php, this is the one Twilio say to use if you don’t use composer, but then I have to somehow import this into my class but the class I want to extend is inside the require statement so it fails (and is messy, I would prefer the composer method)
You installed the twilio/sdk inside your plugin folder.
You have to install it on the application folder (the root app folder, outside of plugins folder)
I don’t have permission to the root application because it’s a third party application which I am extending, if I alter the main application with every apt update the changes will get undone.
In CakePHP 2 I was able to load vendors inside a plugin, I’m thinking there must be a way even if it’s not standard.
You might be able to do it with some manual edits to the autoload psr-4 section of your plugin’s composer.json. That’s not a Cake-specific thing, so there should be other relevant resources out there to help with it.
Well composer only recognises your composer.json (and therefore your dependencies) if your plugin is loaded in the root package.json (so the one in the main app folder)
But it still requires you to have access - or tell someone - to adjust the root composer.json because it needs to require your plugins composer.json. Without that no autoloading will work.
And I would hardly discourage you to fiddle around with manually autoloading something with your own spl_autoload_register() function.
I actually just tried to refactor all my plugin namespaces to be autoloaded via composer only (via requiring the local package which should load the namespace from the composer.json inside the plugin)
But it seems that at least phpunit has problems with that because its missing some namespaces. (Main app works for some reason )