[Development Guides Home](/guides) >> [Guide to the LiveAPI System](/guides/guide-to-the-liveapi-system) # Guide to the LiveAPI System - PHP Class The LiveAPI PHP Class provides an environment for PHP applications. You can find this PHP class in the `/usr/local/cpanel/php/cpanel.php` file. ## Basic use * PHP applications that use the LiveAPI PHP class **must** instantiate the CPANEL object. * PHP filenames **must** end in either the `.livephp` or `.live.php` file extensions. * Save files to the `/usr/local/cpanel/base/frontend/theme/` directory, where `theme` represents the cPanel theme, or create a symlink to the appropriate files. The following example script uses the LiveAPI PHP class to call the [`DomainInfo::domains_data`](/openapi/cpanel/operation/domains_data/) UAPI function: ```php // Instantiate the CPANEL object. require_once "/usr/local/cpanel/php/cpanel.php"; // Connect to cPanel - only do this once. $cpanel = new CPANEL(); // Get domain user data. $get_userdata = $cpanel->uapi( 'DomainInfo', 'domains_data', array( 'format' => 'hash', ) ); // Perform the desired actions. ``` ### Instantiate the CPANEL object ```php // Instantiate the CPANEL object. require_once "/usr/local/cpanel/php/cpanel.php"; ``` This instantiates the `CPANEL` object. This ensures that the script or application uses the LiveAPI PHP class. ### Connect to cPanel & WHM ```php // Connect to cPanel - only do this once. $cpanel = new CPANEL(); ``` This uses the LiveAPI `new()` method to connect to cPanel & WHM. For more information, read our [LiveAPI Methods](/guides/guide-to-the-liveapi-system/guide-to-the-liveapi-system-liveapi-methods) documentation. * You **must** include this line in all LiveAPI PHP code. * **Only** include this line **once** in any file. ### Call cPanel & WHM API 1 functions ```php // Get domain user data. $get_userdata = $cpanel->uapi( 'DomainInfo', 'domains_data', array( 'format' => 'hash', ) ); ``` This part of the script uses the `uapi()` method to call the [`DomainInfo::domains_data`](/openapi/cpanel/operation/domains_data/) UAPI function, and assign the function's output as a hash reference to the `$get_userdata` variable. * You can call multiple functions in a single file. * For more information and use examples, read that function's documentation. All cPanel API 1, cPanel API 2, and UAPI function documents include specific examples for the LiveAPI PHP class. ### Perform the desired actions ```php // Perform the desired actions. ``` Your script or application's actions could combine any of PHP's many functions.