zenddevops / webapi
Provides easy access to Zend Server API
Installs: 13 814
Dependents: 2
Suggesters: 0
Security: 0
Stars: 8
Watchers: 19
Forks: 11
Open Issues: 0
Requires
- php: >=5.3.3
- zendframework/zend-config: >=2.0.0
- zendframework/zend-console: >=2.0.0
- zendframework/zend-file: >=2.0.0
- zendframework/zend-form: >=2.0.0
- zendframework/zend-http: >=2.0.0
- zendframework/zend-loader: >=2.0.0
- zendframework/zend-log: >=2.0.0
- zendframework/zend-modulemanager: >=2.0.0
- zendframework/zend-mvc: >=2.0.0
- zendframework/zend-serializer: >=2.0.0
- zendframework/zend-servicemanager: >=2.0.0
- zendframework/zend-stdlib: >=2.0.0
- zendframework/zend-text: >=2.0.0
- zendframework/zend-version: >=2.0.0
- zendframework/zend-view: >=2.0.0
This package is auto-updated.
Last update: 2024-12-22 20:39:36 UTC
README
ZF2 module that ease Zend Server API usage
Zend Framework 2 API
To use a Zend Server API, call the APIManager form the service locator :
$apiManager = $serviceLocator->get('zend_server_api');
And then send the request and retrieve the response like this :
$apiResponse = $apiManager->apiMethodName();
Where ApiMethodName is the API method : getNotifications, cacheClear, etc.... see Zend Server Web API documentation. $apiResponse will be ApiResponse instance and can be used a SimpleXMLElement to get XML Data. By exemple the clusterGetServerStatus method will return a response in which you can acces data like that :
$nodeCount = $apiResponse->responseData->serverList->count(); //To know the number a nodes in the cluster
$serverStatus = $apiResponse->responseData->serverList->serverInfo[0]->status // To know the status of the first node
API Request parameters POST or GET can be passed to the ApiManger by using an array :
$response = $apiManager->auditGetList(array(
'limit' => 5,
'order' => 'creation_time',
'direction' => 'DESC'
));
Setting
You can set a default configuration of your environment in the zendserverwebapi.conf.php file under the 'zsapi' key:
'zsapi' => array (
//Configuratin of the HTTP client that will connect to the Zend Server
'client' => array (
'adapter' => 'Zend\Http\Client\Adapter\Curl',
),
// Target - the Zend Server you want to reach through API
'target' => new ArrayObject(array (
'zsurl' => 'http://localhost:10081', //
'zskey' => '<SECRET-NAME>',
'zssecret' => '<SECRET-HASH>',
'zsversion' => '6.1',
)),