Version 6.0 and Namespacing

From WHMCS Documentation

Revision as of 21:27, 7 July 2015 by Matt (talk | contribs) (Created page with "WHMCS Version 6.0 introduces namespacing to WHMCS classes. The result of this is that if you are referencing native WHMCS class files from your custom modules, hooks and code...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

WHMCS Version 6.0 introduces namespacing to WHMCS classes.

The result of this is that if you are referencing native WHMCS class files from your custom modules, hooks and code, where previously you may have referenced a class as follows:

$client = new WHMCS_User_Client();

In 6.0 and later, you would need to first alias the class with a use statement, and then invoke it by name as follows.

use WHMCS\User\Client;

$client = new Client();

The only exception to this is the WHMCS_ClientArea class for which backwards compatibility for the previous WHMCS_ClientArea class name has been preserved to ensure pages created using the code at Creating Pages continue to work without requiring any changes. The ClientArea class can now be accessed and used using either method.