1. Go to this page and download the library: Download la-souris/credit-check-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/ */
la-souris / credit-check-sdk example snippets
interface CreditChecker
{
public function submitCheck(CreateCreditCheck $request): CreateCreditCheckResponse;
public function getResult(string $reference): GetCreditCheckResponse;
public function getChangedChecksSince(DateTimeInterface $since): ChangedChecksResponse;
}
$response = $checker->getResult($reference);
$response->reference; // and the rest of GetCreditCheckResponse's own fields, read directly
$response->provider; // machine name of the bureau that answered, e.g. 'edr'
$response->raw; // that bureau's response body, decoded but otherwise untouched
#[Provider(
name: 'edr',
countries: ['NL'], // ISO 3166-1 alpha-2
currencies: ['EUR'], // ISO 4217
capabilities: [Capability::CREATE_CHECK, Capability::GET_RESULT, Capability::LIST_CHANGED],
)]
final class EdrCreditChecker implements CreditChecker
{
use GuardsProviderReach; // assertSupportedCountry() / assertSupportedCurrency()
// submitCheck / getResult / getChangedChecksSince
}
$util = PhoneNumberUtil::getInstance();
$number = $util->parse('06 12345678', 'NL'); // NumberParseException if malformed
new ContactInformation('[email protected]', $number);
// -> InvalidArgumentException if the number is well-formed but cannot exist
$util->format($number, PhoneNumberFormat::E164); // '+31612345678' — for a wire payload
$util->format($number, PhoneNumberFormat::NATIONAL); // '06 12345678' — for a UI
use LaSouris\CreditCheck\Sdk\CreditCheck\Applicant;
use LaSouris\CreditCheck\Sdk\CreditCheck\Applicant\{Address, ContactInformation, Gender, Person};
use LaSouris\CreditCheck\Sdk\CreditCheck\{SalesChannel, Subject};
use LaSouris\CreditCheck\Sdk\Request\CreateCreditCheck;
use libphonenumber\PhoneNumberUtil;
use Money\Money;
// Money::EUR(cents) — the MoneyFactory trait is composed onto Money
$person = new Person(
initials: 'J.',
firstName: 'Jan',
surname: 'de Vries',
gender: Gender::Male,
dateOfBirth: new DateTimeImmutable('1990-05-01'),
contactInformation: new ContactInformation(
email: '[email protected]',
mobileNumber: PhoneNumberUtil::getInstance()->parse('06 12345678', 'NL'),
),
address: new Address(
country: 'NL',
houseNumber: '12A', // one string; suffixed numbers survive intact
street: 'Kerkstraat',
postalCode: '1011AA',
city: 'Amsterdam',
occupants: 2,
),
);
$applicant = new Applicant(person: $person, partner: $partner); // both
$response = $checker->getResult($receipt->reference);
$response->decision; // Response\Decision: Pending | Approved | Referred | Rejected
$response->status; // Response\CheckStatus: Submitted | InProgress | Completed | Unknown
$response->trafficLight; // ?Response\TrafficLight: Green | Orange | Red
$response->expendableIncome; // ?Money\Money — what the household can carry per month
$response->rejectionReasons; // list<Response\RejectionReason>, each a provider code
$response->applicantResults; // list<Response\ApplicantResult>, in submitted order
$response->startedAt; // ?DateTimeImmutable
$response->completedAt; // ?DateTimeImmutable
$response->raw; // the provider's decoded response, untouched
$response->isApproved();
$response->isRejected();
$response->isFinal(); // stop polling when true
$reach = ProviderCapabilities::of($checker);
$reach->supports(Capability::LIST_CHANGED); // change-feed available?
$reach->assesses('NL'); // handles this country?
$reach->accepts(new Money\Currency('EUR')); // handles this currency?
public function submitCheck(CreateCreditCheck $request): CreditCheckReceipt
{
$this->assertSupportedCurrency($request->subject->amount->getCurrency());
$this->assertSupportedCountry($request->primaryApplicant()->address->country);
// ...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.