LoanPro PHP SDK
LoanPro PHP SDK

Introduction

The goal of the LoanPro PHP SDK is to abstract the complexity of the LoanPro system and allow developers to create fast applications. This is accomplished by abstracting OData entities into PHP classes and providing a list of properties for each class. This list of constants allows integrating code to not have to change in the event of a property name change. This means that if all properties called "active" are renamed to "isActive", the constants list will be updated and integrating code will work once the new SDK is installed. Furthermore, the SDK does a lot of validation and input sanitization, as well as error parsing. Also, it provides several methods for credential management as well as integrating with both production and staging environments.

To show how simple it is to use the SDK, below is a sample of creating a modification for a loan and doubling the lending amount:

use \Simnang\Loanpro\Constants\LOAN, \Simnang\Loanpro\Constants\LOAN_SETUP, \Simnang\Loanpro\Loans\LoanSetupEntity;
$loan = LoanProSDK::GetInstance()->GetLoan(55, [LOAN::LOAN_SETUP]);
$lsetup = $loan->Get(LOAN::LOAN_SETUP);
$loan->createModification($lsetup->Set(LOAN_SETUP::LOAN_AMT, $lsetup->Get(LOAN_SETUP::LOAN_AMT) / 2));

Below is an example of halving the loan amount, discount, and interest rate for another loan and then saving the changes to the server:

use \Simnang\Loanpro\Constants\LOAN, \Simnang\Loanpro\Constants\LOAN_SETUP, \Simnang\Loanpro\Loans\LoanSetupEntity;
$halve = function($a){ return $a / 2; };
$loan = LoanProSDK::GetInstance()->GetLoan(55, [LOAN::LOAN_SETUP]);
$lsetup = $loan->Get(LOAN::LOAN_SETUP);
$loan->Set(LOAN::LOAN_SETUP, $lsetup->Set(array_map($halve,$lsetup->Get(LOAN_SETUP::LOAN_AMT, LOAN_SETUP::DISCOUNT, LOAN_SETUP::LOAN_RATE))))->save();

When using the SDK, it is important to remember that the Set, Rem, and Del functions don't change the entity, instead they returns a modified copy of an entity. This allows all entities to act as prototypes for creating more entities.

Below is an example of how the Set function works:

use \Simnang\Loanpro\Constants\LOAN;
$loan = LoanProSDK::GetInstance()->GetLoan(55, [LOAN::LOAN_SETUP])->Set(LOAN::DISP_ID,'initial');
$loan->Set(LOAN::DISP_ID, 'foo');
echo $loan->Get(LOAN::DISP_ID); // echos 'initial'
$loan = $loan->Set(LOAN::DISP_ID, 'bar');
echo $loan->Get(LOAN::DISP_ID); // echos 'bar'
echo $loan->Set(LOAN::DISP_ID,'foobar')->Get(LOAN::DISP_ID); // echos 'foobar'
echo $loan->Get(LOAN::DISP_ID); // echos 'bar'

Getting Started

To get started with the PHP SDK, we recommend that you start with one of the following resources:

Reference Documentation

We have a lot of reference documentation to help you learn more about what is offered. Below is a list of all reference documentation available: