https://github.com/vitexsoftware/php-pohoda-connector
client library for Sormware's Pohoda mServer
https://github.com/vitexsoftware/php-pohoda-connector
api-client api-client-php php php-library pohoda stormware
Last synced: 7 months ago
JSON representation
client library for Sormware's Pohoda mServer
- Host: GitHub
- URL: https://github.com/vitexsoftware/php-pohoda-connector
- Owner: VitexSoftware
- License: mit
- Created: 2020-11-08T05:21:35.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-07-11T18:44:12.000Z (7 months ago)
- Last Synced: 2025-07-11T19:24:51.033Z (7 months ago)
- Topics: api-client, api-client-php, php, php-library, pohoda, stormware
- Language: PHP
- Homepage:
- Size: 1.56 MB
- Stars: 15
- Watchers: 5
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# PHPmServer
client library for Stormware's [mPohoda mServer](https://www.stormware.cz/pohoda/xml/mserver/)

The PHP-Pohoda-Connector library provides a set of features to interact with the Pohoda accounting software. Below are some of the key features along with code examples:
Features:
* Check connection
* Create/Update/Delete AddressBook record
* Create/Update/Delete Invoice record
* Create/Update/Delete Bank movement record




## Installation
Install using composer:
```shell
composer require vitexsoftware/pohoda-connector
```
Or clone
## Configuration
Classess check at startup for this constants or environment variables:
* **POHODA_ICO** - company indentificator
* **POHODA_URL** - mServer endpoint
* **POHODA_USERNAME** - Pohoda user's login
* **POHODA_PASSWORD** - Pohoda user's password
* **POHODA_TIMEOUT** - Curl timeout
* **POHODA_COMPRESS** - compress is disabled by default
* **POHODA_DEBUG** - debug mode is disabled by default
## Note on Encoding
Pohoda always produces XML encoded in `windows-1250`. This library will automatically convert all incoming XML to UTF-8 before processing. As a result, all parsed data and strings you receive from this library will be in UTF-8 encoding, regardless of the original XML encoding.
---
## Usage
1. Check Connection
This feature allows you to check if the connection to the Pohoda server is successful.
```php
logBanner();
}
echo $client->isOnline() ? 'Online' : 'Offline';
```
1. Add Addressbook record
This feature allows you to add a new addressbook record.
```php
[
'address' => [
'company' => 'Vitex Software',
'name' => 'Vítězslav Dvořák',
'city' => 'Prague',
'street' => 'Long',
'zip' => '15800',
'ico' => '69438676',
'dic' => 'CZ7808072811',
],
],
'mobil' => '739 778 202',
'web' => 'https://www.vitexsoftware.cz',
];
$addresser = new Adressbook($addressBookRecord);
$addresser->addToPohoda();
if ($addresser->commit()) {
print_r($addresser->response->producedDetails);
}
```
1. Create Invoice
This feature allows you to create a new invoice.
```php
'issuedInvoice',
'date' => date('Y-m-d'),
'accounting' => ['ids' => '3Fv'],
'text' => 'Faktura za zboží bez adresy',
'paymentType' => 'draft',
'note' => 'Import XML.',
'intNote' => 'Tento doklad byl vytvořen importem přes XML z PHP.',
'invoiceSummary' => [
'roundingDocument' => 'math2one',
'homeCurrency' => [
'priceNone' => 3018,
'priceLow' => 60000,
'priceHighSum' => 557,
],
],
];
\Ease\Shared::init(['POHODA_URL', 'POHODA_USERNAME', 'POHODA_PASSWORD'], \dirname(__DIR__).'/.env');
$invoicer = new Invoice($invoiceRecord);
$itemRecord = [
'text' => 'Židle Z220',
'quantity' => 1.0,
'unit' => 'ks',
'payVAT' => false,
'rateVAT' => 'high',
'homeCurrency' => [
'unitPrice' => 1968,
'price' => 1968,
'priceVAT' => 413.28,
'priceSum' => 2381.28,
],
'code' => 'Z220',
'stockItemIDS' => 'Z220',
];
$invoicer->addItem($itemRecord);
$invoicer->addToPohoda();
if ($invoicer->commit()) {
print_r($invoicer->response->producedDetails);
}
```
1. Addressbook reading
This feature allows you to read an addressbook record.
```php
getColumnsFromPohoda(['id', 'jmeno', 'email', 'web']));
```
See usage examples in [tests](tests) directory
* [Check Connection](tests/check-connection.php)
* [Add Addressbook record](tests/insert-address.php)
* [Create Invoice](tests/insert-invoice.php)
* [Addressbook reading](tests/read-address.php)
* [Address update](tests/update-address.php)
**Many thanks to [Riešenia, spol. s r.o.](https://www.riesenia.com/) for its library **
See my other libraries: ,