PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

BaseUserService

The class can be used to set and get quota values for the services and to fetch account details.

The getAccountBalance() method fetches an array of account id's with the current balance status (credits).

Example 800. Get account balance example

<?php
$service 
= new Zend_Service_DeveloperGarden_BaseUserService($config);
print_r($service->getAccountBalance());

Get quota information

You can fetch quota informations for a specific service module with the provided methods.

Example 801. Get quota information example

<?php
$service 
= new Zend_Service_DeveloperGarden_BaseUserService($config);
$result $service->getSmsQuotaInformation(
    
Zend_Service_DeveloperGarden_BaseUserService::ENV_PRODUCTION
);
echo 
'Sms Quota:<br />';
echo 
'Max Quota: '$result->getMaxQuota(), '<br />';
echo 
'Max User Quota: '$result->getMaxUserQuota(), '<br />';
echo 
'Quota Level: '$result->getQuotaLevel(), '<br />';

You get a result object that contains all the information you need, optional you can pass to the QuotaInformation method the environment constant to fetch the quota for the specific environment.

Here a list of all getQuotaInformation methods:

  • getConfernceCallQuotaInformation()

  • getIPLocationQuotaInformation()

  • getLocalSearchQuotaInformation()

  • getSmsQuotaInformation()

  • getVoiceCallQuotaInformation()

Change quota information

To change the current quota use one of the changeQuotaPool methods. First parameter is the new pool value and the second one is the environment.

Example 802. Change quota information example

<?php
$service 
= new Zend_Service_DeveloperGarden_BaseUserService($config);
$result $service->changeSmsQuotaPool(
    
1000,
    
Zend_Service_DeveloperGarden_BaseUserService::ENV_PRODUCTION
);
if (!
$result->hasError()) {
    echo 
'updated Quota Pool';
}

Here a list of all changeQuotaPool methods:

  • changeConferenceCallQuotaPool()

  • changeIPLocationQuotaPool()

  • changeLocalSearchQuotaPool()

  • changeSmsQuotaPool()

  • changeVoiceCallQuotaPool()

Zend Framework