PHP code example of konsulting / justgiving-api-sdk
1. Go to this page and download the library: Download konsulting/justgiving-api-sdk 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/ */
konsulting / justgiving-api-sdk example snippets
$auth = new AppAuth('abcde123');
$client = new JustGivingClient($auth);
$response = $client->account->isEmailRegistered('[email protected]');
if ($response->existenceCheck()) {
echo 'An account has been registered with that email.';
}
$response = $client->charity->getById(2050);
if (! $response->wasSuccessful()) {
throw new Exception(implode(', ', $response->errors));
}
$response->name; // 'The Demo Charity1'
$response->websiteUrl; // 'http://www.democharity.co.uk'
$response->pageShortName; // 'jgdemo'
$auth = new BasicAuth('abced123', '[email protected]', 'pass123');
$httpClient = new \My\Own\Psr18Client;
$options = [
'root_domain' => 'https://api.staging.justgiving.com',
'api_version' => 2,
];
$client = new JustGivingClient($auth, $httpClient, $options);
$client->donation->getStatus($donationId); // The actual method
$client->donation->RetrieveDonationStatus($donationId); // The alias method that's the same as the API action name
// Data set via constructor
$team = new Team([
'name' => 'My Team',
'story' => 'This is my story',
'target' => 1000,
]);
// Data set via fill() method
$team = new Team;
$team->fill([
'name' => 'My Team',
'story' => 'This is my story',
'target' => 1000,
]);
// Data set by setting public properties individually
$team = new Team;
$team->name = 'My Team';
$team->story = 'This is my story';
$team->target = 1000;