PHP code example of mradionov / phonegap-build-api
1. Go to this page and download the library: Download mradionov/phonegap-build-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mradionov / phonegap-build-api example snippets
use PhonegapBuildApi;
// Use token
$api = new PhonegapBuildApi('authentication_token');
// Use username and password
$api = new PhonegapBuildApi('[email protected]', 'password');
// Set auth options after init
$api = new PhonegapBuildApi();
$api->setToken('authentication_token');
$api->setCredentials('[email protected]', 'password');
// Use factory
$res = PhonegapBuildApi::factory('[email protected]', 'password')->getProfile();
use PhonegapBuildApi;
$api = new PhonegapBuildApi();
$api->setAccessToken('d4f5g6');
$res = $api->getProfile();
if ($api->success()) {
var_dump($res['email']); // '[email protected]'
} else {
var_dump($api->error()); // 'Invalid email or password.'
}
$res = $api->createApplicationFromRepo('https://github.com/phonegap/phonegap-start', array(
'title' => 'Phonegap Application',
// see docs for all options
));
$res = $api->createApplicationFromFile('/path/to/archive.zip', array(
'title' => 'Phonegap Application',
// see docs for all options
));
$res = $api->updateApplication(5, array(
'title' => 'Phonegap Application',
// better use methods below or see docs for all options
));
$res = $api->updateApplicationFromRepo(5, array(
'title' => 'Phonegap Application',
// see docs for all options
));
$res = $api->updateApplicationFromFile(5, '/path/to/archive.zip', array(
'title' => 'Phonegap Application',
// see docs for all options
));
$res = $api->addCollaborator(5, array(
'email' => '[email protected]',
'role' => PhonegapBuildApi::ROLE_TESTER, // PhonegapBuildApi::ROLE_DEV
// see docs for all options
));
$res = $api->updateCollaborator(5, 7, array(
'role' => PhonegapBuildApi::ROLE_TESTER, // PhonegapBuildApi::ROLE_DEV
// see docs for all options
));
$res = $api->addKeyPlatform(PhonegapBuildApi::IOS, array(
// better use methods below or see docs for all options
));
$res = $api->addKeyPlatform(PhonegapBuildApi::ANDROID, array(
// better use methods below or see docs for all options
));
$res = $api->addKeyAndroid('Key Title', '/path/to/key.keystore', array(
'alias' => 'release',
// see docs for all options
));
$res = $api->addKeyIos('Key Title', '/path/to/key.p12', '/path/to/key.mobileprovision', array(
// see docs for all options
));
$res = $api->updateKeyPlatform(PhonegapBuildApi::IOS, 3, array(
// better use methods below or see docs for all options
));
$res = $api->updateKeyPlatform(PhonegapBuildApi::ANDROID, 3, array(
// better use methods below or see docs for all options
));