pRieStaKos Posted September 28, 2016 Share Posted September 28, 2016 Hello, I'm trying to create a widget and when I set the `use` for the class namespaces, I got the error "Fatal error: Cannot find class in...." require_once '../vendor/autoload.php'; use api-vendor\api\client\GetAccountBalance; use api-vendor\api\configuration\BasicAuthConfiguration; function widget_get_balance($vars) { $client = new GetAccountBalance(new BasicAuthConfiguration($USERNAME, $PASSWORD)); } I upload the API for my widget in /vendor folder, I used `autoload.php` in my widget and still getting the same error. Any suggestions ? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted September 28, 2016 Share Posted September 28, 2016 you need to upload these files outside on the "vendor" directory, they will be removed as soon as you run composer update, upload it elsewhere and create your own autoload function 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted September 28, 2016 Author Share Posted September 28, 2016 Thank you sentq I didn't know that composer was removing the api in vendor folder. Maybe I should use `include` for the needed classes only and not autoload the whole api. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted September 28, 2016 Share Posted September 28, 2016 I mean it may delete custom files that is not related to specific package in there, at least this is how it is working with me all the time. from WHMCS v7 Release Notes http://docs.whmcs.com/Version_7.0_Release_Notes We do not recommend nor support placing your own classes within the WHMCS namespace. WHMCS assumes full authority of the WHMCS namespace and classes directories and offer no guarantees that files you place there will not be overwritten or removed. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.