PHPackages                             spojenet/pohoda-sql - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. spojenet/pohoda-sql

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

spojenet/pohoda-sql
===================

Management Library for PohodaSQL

v0.2.2(1mo ago)92192[1 PRs](https://github.com/Spoje-NET/PohodaSQL/pulls)MITPHPCI failing

Since Oct 3Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/Spoje-NET/PohodaSQL)[ Packagist](https://packagist.org/packages/spojenet/pohoda-sql)[ RSS](/packages/spojenet-pohoda-sql/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (3)Dependencies (12)Versions (9)Used By (0)

PohodaSQL
=========

[](#pohodasql)

[![PohodaSQL](pohodaSQL.svg?raw=true)](pohodaSQL.svg?raw=true)

[![PHP Version](https://camo.githubusercontent.com/4c62148864d567c4ee794ffab09c1dd4a3f45e41064bbb016440beddaae71a4d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e322d3838393242462e737667)](https://php.net/)[![CodeRabbit Pull Request Reviews](https://camo.githubusercontent.com/c79290661a99892b135d3c02414938445d802367101465c40f6bd397fd6a936d/68747470733a2f2f696d672e736869656c64732e696f2f636f64657261626269742f7072732f6769746875622f53706f6a652d4e45542f506f686f646153514c3f75746d5f736f757263653d6f73732675746d5f6d656469756d3d6769746875622675746d5f63616d706169676e3d53706f6a652d4e4554253246506f686f646153514c266c6162656c436f6c6f723d31373137313726636f6c6f723d464635373041266c696e6b3d6874747073253341253246253246636f64657261626269742e6169266c6162656c3d436f64655261626269742b52657669657773)](https://camo.githubusercontent.com/c79290661a99892b135d3c02414938445d802367101465c40f6bd397fd6a936d/68747470733a2f2f696d672e736869656c64732e696f2f636f64657261626269742f7072732f6769746875622f53706f6a652d4e45542f506f686f646153514c3f75746d5f736f757263653d6f73732675746d5f6d656469756d3d6769746875622675746d5f63616d706169676e3d53706f6a652d4e4554253246506f686f646153514c266c6162656c436f6c6f723d31373137313726636f6c6f723d464635373041266c696e6b3d6874747073253341253246253246636f64657261626269742e6169266c6162656c3d436f64655261626269742b52657669657773)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)[![Composer](https://camo.githubusercontent.com/d152a9b4679e77fa3deadbb5d7b05c5541d222ddd09fdfc1da626adb8f8a3196/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6d706f7365722d737570706f727465642d3838353633302e737667)](https://getcomposer.org/)[![Debian Package](https://camo.githubusercontent.com/220592ec112a96fcff33f91eeb77a5582dab5ac5ae32fd5747e1535cddab345f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f64656269616e2d7061636b6167652d7265642e737667)](http://repo.vitexsoftware.com/pool/main/p/php-spojenet-pohoda-sql/)[![Latest Stable Version](https://camo.githubusercontent.com/8de6ec53a5e2ef17babfe9c8c3e52ae01e80e22ead85d6379414153969189c3f/687474703a2f2f706f7365722e707567782e6f72672f73706f6a656e65742f706f686f64612d73716c2f76)](https://packagist.org/packages/spojenet/pohoda-sql) [![Total Downloads](https://camo.githubusercontent.com/87303f5aac97c793e41793c1bea3f9c80c367a11420af922022fa1ea65325611/687474703a2f2f706f7365722e707567782e6f72672f73706f6a656e65742f706f686f64612d73716c2f646f776e6c6f616473)](https://packagist.org/packages/spojenet/pohoda-sql) [![Latest Unstable Version](https://camo.githubusercontent.com/4b16d0558e6bf501c9ac38d384669fc59d86cc0718fafcaeaa047a34bae38af3/687474703a2f2f706f7365722e707567782e6f72672f73706f6a656e65742f706f686f64612d73716c2f762f756e737461626c65)](https://packagist.org/packages/spojenet/pohoda-sql) [![License](https://camo.githubusercontent.com/e4cc71accb54320856b25f1c2e4e6e22ada7db2f9c2b8703319a3c335d8be127/687474703a2f2f706f7365722e707567782e6f72672f73706f6a656e65742f706f686f64612d73716c2f6c6963656e7365)](https://packagist.org/packages/spojenet/pohoda-sql) [![PHP Version Require](https://camo.githubusercontent.com/f52c6190cf1fbecf0d3f5badc90da87714c0dd3913cd42420e04e893a1750dbe/687474703a2f2f706f7365722e707567782e6f72672f73706f6a656e65742f706f686f64612d73716c2f726571756972652f706870)](https://packagist.org/packages/spojenet/pohoda-sql)

This is a PHP Library for direct access to Pohoda SQL database tables. Struct definitions are kept in sync with a live Pohoda SQL database (`StwPh_12345678_2026` on SQL Server Express).

Use at your own risk!

Available Classes
-----------------

[](#available-classes)

ClassTableDescription`Adresar``AD`Address book`BankovniVypis``BV`Bank statement`BankovniVypisPol``BVpol`Bank statement line item`CasoveRozliseni``CasRoz`Time resolution`CasoveRozliseniPol``CasRozPol`Time resolution line item`CiselnaRada``sCRady`Number series`DOC``DOC`Document attachments`Faktura``FA`Issued/received invoices`FakturaPolozka``FApol`Invoice line items`HotovostniOperace``HO`Cash document`HotovostniOperacePol``HOpol`Cash document line item`Majetek``IM`Fixed assets`MajetkoveOperace``IMpohyb`Asset movements`Nabidka``NAB`Offer`NabidkaPol``NABpol`Offer line item`ObjednavkaPrijata``OBJ`Received order`ObjednavkaPrijataPol``OBJpol`Received order line item`OdpisovyPlan``sIMO`Depreciation plans`Pokladna``PH`Cash register document`PokladnaPol``PHpol`Cash register line item`Predkontace``pPK`Pre-accounting`Predmet``IMpredm`Asset subjects`Uhrada``Uhrady`Payment`Zamestnanec``ZAM`Employee`Zasilka``Zasilky`Shipment`ZasilkaPol``ZasilkyPol`Shipment line itemRequirements
------------

[](#requirements)

- PHP 7.2+
- php-sqlsrv
- php-ease-fluentpdo

Composer
--------

[](#composer)

```
composer require spojenet/pohoda-sql
```

Configuration
-------------

[](#configuration)

Please set up this constants or environment variables:

- `DB_TYPE` We use sqlsrv
- `DB_HOST` IP or Hostname machine with SQL Server
- `DB_PORT` default is 1433
- `DB_DATABASE` something like StwPh\_01234567\_2019
- `DB_USERNAME` sqlserver login
- `DB_PASSWORD` sqlserver pass
- `DB_SETTINGS` eg. encrypt=false

Usage
-----

[](#usage)

### Load a record by ID

[](#load-a-record-by-id)

```
$addr = new Adresar(234);
echo $addr->getDataValue('Firma'); // company name
```

### Load by a field value

[](#load-by-a-field-value)

```
$addr = new Adresar(['ICO' => '69438676']);
echo $addr->getDataValue('Email');
```

### Override the database at instantiation

[](#override-the-database-at-instantiation)

```
$addr = new Adresar(234, ['database' => 'StwPh_01234567_2020']);
```

### Read invoice header and its line items

[](#read-invoice-header-and-its-line-items)

```
$invoice = new Faktura(1001);
echo $invoice->getDataValue('Cislo');   // document number
echo $invoice->getDataValue('KcCelkem'); // total amount

$lines = new FakturaPolozka();
$rows  = $lines->getColumnsFromSQL(['Nazev', 'Mnozstvi', 'KcCena'], ['RefAg' => 1001]);
foreach ($rows as $row) {
    echo $row['Nazev'] . ' × ' . $row['Mnozstvi'] . ' = ' . $row['KcCena'] . PHP_EOL;
}
```

### List all addresses with a credit limit

[](#list-all-addresses-with-a-credit-limit)

```
$addr = new Adresar();
$rows = $addr->getColumnsFromSQL(['Cislo', 'Firma', 'ADKreditMax'], ['ADKreditMax>' => 0]);
foreach ($rows as $row) {
    printf("%s  %s  (limit: %s)\n", $row['Cislo'], $row['Firma'], $row['ADKreditMax']);
}
```

### Work with bank statements

[](#work-with-bank-statements)

```
$bv  = new BankovniVypis(['Cislo' => 'BV2024001']);
$pol = new BankovniVypisPol();
$items = $pol->getColumnsFromSQL(['KcCastka', 'VS', 'Datum'], ['RefBV' => $bv->getMyKey()]);
```

### Iterate shipments

[](#iterate-shipments)

```
$zasilky = new Zasilka();
$list    = $zasilky->getColumnsFromSQL(['ID', 'Cislo', 'RefAD', 'DatOdeslani']);
foreach ($list as $z) {
    echo $z['Cislo'] . ' – ' . $z['DatOdeslani'] . PHP_EOL;
}
```

### Access employees

[](#access-employees)

```
$zam = new Zamestnanec(['RodCisl' => '8001011234']);
echo $zam->getDataValue('Prijmeni') . ' ' . $zam->getDataValue('Jmeno');
```

### Attach a URL link to a Pohoda document

[](#attach-a-url-link-to-a-pohoda-document)

The `DOC` table stores document attachments for every agenda. Use `urlAttachment()` to link an external URL (e.g. a SharePoint file, a web invoice, a tracking page) to an existing record. The second argument is the Pohoda internal document ID; the agenda type is identified by one of the `Agenda::*` constants.

```
use SpojeNet\PohodaSQL\Agenda;
use SpojeNet\PohodaSQL\DOC;

// Attach a SharePoint link to a bank statement (agenda = Agenda::BANK = 28)
$doc = new DOC();
$doc->setDataValue('RelAgID', Agenda::BANK);
$doc->urlAttachment(
    pohodaId: 303,                                          // DOC.RelID – internal Pohoda record ID
    url: 'https://sharepoint.example.com/statements/BV2024001.pdf',
    name: 'BV2024001.pdf',                                 // display name shown in Pohoda
);

// Attach a link to an issued invoice (agenda = Agenda::ISSUED_INVOICES = 2)
$doc = new DOC();
$doc->setDataValue('RelAgID', Agenda::ISSUED_INVOICES);
$doc->urlAttachment(1001, 'https://portal.example.com/invoice/1001', 'Invoice PDF');
```

Available `Agenda::*` constants mirror the `RelCrAg` values from `sCRady`:

ConstantValueAgenda`Agenda::ISSUED_INVOICES`2Issued invoices`Agenda::RECEIVED_INVOICES`3Received invoices`Agenda::ORDERS_RECEIVED`11Received orders`Agenda::CASH_REGISTER`27Cash register`Agenda::BANK`28Bank statementsSee  for more information.

Debian Package
--------------

[](#debian-package)

also package for debian/ubuntu is availble:

```
wget -qO- https://repo.vitexsoftware.com/KEY.gpg | sudo tee /etc/apt/trusted.gpg.d/vitexsoftware.gpg
echo "deb [signed-by=/etc/apt/trusted.gpg.d/vitexsoftware.gpg]  https://repo.vitexsoftware.com  $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/vitexsoftware.list
sudo apt update

sudo apt install php-spojenet-pohoda-sql
```

###  Health Score

43

—

FairBetter than 90% of packages

Maintenance94

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 61.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~480 days

Total

3

Last Release

33d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c37ffb57ec14670613115c03edd4258168c3eb2353d0990817bf90cf94990311?d=identicon)[Spoje.Net](/maintainers/Spoje.Net)

---

Top Contributors

[![Vitexus](https://avatars.githubusercontent.com/u/2621130?v=4)](https://github.com/Vitexus "Vitexus (32 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (19 commits)")[![Aloushek](https://avatars.githubusercontent.com/u/9028853?v=4)](https://github.com/Aloushek "Aloushek (1 commits)")

---

Tags

fintechmssqlphp-librarypohoda

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/spojenet-pohoda-sql/health.svg)

```
[![Health](https://phpackages.com/badges/spojenet-pohoda-sql/health.svg)](https://phpackages.com/packages/spojenet-pohoda-sql)
```

###  Alternatives

[vistag/human-readable

Convert numbers and seconds to the human readable format

132.8k1](/packages/vistag-human-readable)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
