webtize / erply-php-sdk
Erply PHP SDK
Installs: 4 833
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: >=7.4
- ext-curl: *
- ext-json: *
- guzzlehttp/guzzle: >=7.3
- dev-main
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0
- 2.9
- 2.8.60
- 2.8.59
- 2.8.57
- 2.8.56
- 2.8.55
- 2.8.54
- 2.8.53
- 2.8.52
- 2.8.51
- 2.8.50
- 2.8.49
- 2.8.48
- 2.8.47
- 2.8.46
- 2.8.45
- 2.8.44
- 2.8.43
- 2.8.42
- 2.8.41
- 2.8.40
- 2.8.38
- 2.8.37
- 2.8.36
- 2.8.35
- 2.8.34
- 2.8.33
- 2.8.32
- 2.8.31
- 2.8.30
- 2.8.29
- 2.8.28
- 2.8.27
- 2.8.26
- 2.8.24
- 2.8.23
- 2.8.21
- 2.8.20
- 2.8.19
- 2.8.18
- 2.8.17
- 2.8.16
- 2.8.15
- 2.8.14
- 2.8.13
- 2.8.12
- 2.8.11
- 2.8.9
- 2.8.8
- 2.4.0
- 2.3.10
- 2.3.7
- 2.3.6
- 2.3.5
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.8
- 2.1.7
- 2.1.6
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1
- 2.0
- 1.9
- 1.8.2
- 1.8.1
- 1.8
- 1.7.9
- 1.7.8
- 1.7.7
- 1.7.6
- 1.7.5
- 1.7.4
- 1.7.3
- 1.7.2
- 1.7.1
- 1.7
- 1.6.1
- 1.6
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4
- 1.3.9.2
- 1.3.9.1
- 1.3.9
- 1.3.8.3
- 1.3.8.2
- 1.3.8.1
- 1.3.8
- 1.3.7.1
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3
- 1.1
- v1.0
- 0.1.0
- dev-add-license-2
- dev-add-license-1
This package is auto-updated.
Last update: 2025-06-16 05:15:34 UTC
README
Import Library into project
You can use
"composer require webtize/erply-php-sdk"
Add into Composer.json file in project
"repositories": [
{
"type": "vcs",
"url": "https://github.com/webtize/erply-php-sdk"
}
]
"require": {
"webtize/erply-php-sdk": "^1.0"
}
In terminal execute command "composer update"
How to Use Library
Creating Instance for one account with eviroment variables
Set up .env file
Add
ERPLY_CLIENTID=######
ERPLY_USER = ######
ERPLY_PASS = ######
into you .env file of project
gettting Instance
$erply = ErplyAPI::getErplyInstance();
$pim = PIMAPI::getPIMInstance();
$reportApi = ReportAPI::getReportInstance();
Creating Instance for multiple account without eviroment variables
$erply = ErplyAPI::getErplyInstance2($code, $username, $password);
$pim = PIMAPI::getPIMInstance2($code, $username, $password);
$reportAPI = ReportAPI::getReportInstance2($code, $username, $password);
Examples Fetching data from Erply
### Product Group Ids ###
$response = $erply->getProductGroups(['recordsOnPage' => 100, 'pageNo' => $currentPage]);
if ($response->getStatus()->getResponseStatus() == 'ok') {
foreach ($response->getRecords() as $record) {
$this->saveIds($record->getProductGroupID(), $record->getName(), 'group');
}
### Customer Group Ids ###
$response = $erply->getCustomerGroups(['recordsOnPage' => 100, 'pageNo' => $currentPage]);
if ($response->getStatus()->getResponseStatus() == 'ok') {
foreach ($response->getRecords() as $record) {
$this->saveIds($record->getCustomerGroupID(), $record->getName(), 'cgroup');
}
### Suppplier ###
$response = $erply->getSuppliers(['recordsOnPage' => 100, 'pageNo' => $currentPage]);
if ($response->getStatus()->getResponseStatus() == 'ok') {
foreach ($response->getRecords() as $record) {
$name = $record->getCompanyName();
if ($name == null) {
$name = $record->getFullName();
}
####Brands####
$response = $erply->getBrands(['recordsOnPage' => 100, 'pageNo' => $currentPage]);
if ($response->getStatus()->getResponseStatus() == 'ok') {
foreach ($response->getRecords() as $record) {
$this->saveIds($record->getBrandID(), $record->getName());
}
####Dimentions#####
$response = $erply->getMatrixDimensions(['recordsOnPage' => 100, 'pageNo' => $currentPage]);
if ($response->getStatus()->getResponseStatus() == 'ok') {
foreach ($response->getRecords() as $record) {
foreach ($record->getVariations() as $variation) {
$this->saveDIds($record->getDimensionID(), $variation->getCode(), 'dimension', $variation->getVariationID());
}
}
}
Example Saving data on Erply
$arr_customers = [];
foreach ($this->customers as $person) {
$customer = new Customer();
$customer->setGroupID($person->CUSTOMERGROUP);
$customer->setIntegrationCode($person->CUSTOMERCODE);
$customer->setFullName($person->CUSTOMERNAME);
$customer->setEmail($person->EMAIL);
$customer->setPhone($person->PHONE1);
$customer->setJobTitleID($person->CONTACTPERSONPOSITION);
$customer->setPaymentDays($person->PAYMENTTERMS);
$customer->setVatNumber($person->ABNNO);
$customer->setCountryID($person->BILLCOUNTRY);
$customer->setRequestID($person->CUSTOMERCODE);
array_push($arr_customers, $customer);
}
$customers = new Customers();
$customers->setRecords($arr_customers);
$response = $this->erply->saveCustomers($customers);
if ($response->getStatus()->getResponseStatus() == 'ok') {
foreach ($response->getRequests() as $request) {
if ($request->getStatus()->getResponseStatus() == 'ok') {
print_r($request->getRecords());
}
}
}
Fetching Data in Bulk from Erply
$arr_payments_query = [];
foreach ($this->getDocs() as $doc) {
array_push($arr_payments_query, ['requestID' => $doc->getId(), 'documentID' => $doc->getId()]);
}
$response = $this->erply->getPaymentsBulk($arr_payments_query);
if ($response->getStatus()->getResponseStatus() == 'ok') {
foreach ($response->getRequests() as $request) {
if ($request->getStatus()->getResponseStatus() == 'ok') {
foreach ($request->getRecords() as $record) {
print_r($record);
}
}
}
}
YOU CAN MAKE YOUR OWN QUERIES and SEnd FROM
$erply->getSingleData([
'request'=>''
]);
$erply->getBulkData([
['requestName'=>''],
['requestName'=>''],
['requestName'=>'']
]);