vitexsoftware/pohoda-connector 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vitexsoftware/pohoda-connector

Composer 安装命令:

composer require vitexsoftware/pohoda-connector

包简介

Stormware's Pohoda mServer client.

README 文档

README

client library for Stormware's mPohoda mServer

Project Logo

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:

  • Check connection
  • Create/Update/Delete records for AddressBook, Invoice, Bank, etc.
  • Broad support for all Pohoda response types (70+ agendas supported)

PHP from Packagist Packagist Version Packagist Downloads GitHub

Installation

Install using composer:

composer require vitexsoftware/pohoda-connector

Or clone https://github.com/VitexSoftware/PHP-Pohoda-Connector.git

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

namespace mServer;

require_once __DIR__.'/../vendor/autoload.php';

\Ease\Shared::init(['POHODA_URL', 'POHODA_USERNAME', 'POHODA_PASSWORD'], \dirname(__DIR__).'/.env');

$client = new \mServer\Client();

if (\Ease\Shared::cfg('APP_DEBUG')) {
    $client->logBanner();
}

echo  $client->isOnline() ? 'Online' : 'Offline';
  1. Add Addressbook record This feature allows you to add a new addressbook record.
<?php

namespace mServer;

require_once __DIR__.'/../vendor/autoload.php';

\Ease\Shared::init(['POHODA_URL', 'POHODA_USERNAME', 'POHODA_PASSWORD'], \dirname(__DIR__).'/.env');

$addressBookRecord = [
    'identity' => [
        '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

namespace mServer;

require_once __DIR__.'/../vendor/autoload.php';

$invoiceRecord = [
    'invoiceType' => '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

require_once '../vendor/autoload.php';
\Ease\Shared::init(['POHODA_URL', 'POHODA_USERNAME', 'POHODA_PASSWORD'], \dirname(__DIR__).'/.env');
$addresser = new \mServer\Addressbook();
print_r($addresser->getColumnsFromPohoda(['id', 'jmeno', 'email', 'web']));

See usage examples in tests directory

Some of Projects using pohoda-connector:

Many thanks to Riešenia, spol. s r.o. for its library https://github.com/riesenia/pohoda

See my other libraries: https://github.com/Spoje-NET/PohodaSQL , https://github.com/Spoje-NET/php-abraflexi

vitexsoftware/pohoda-connector 适用场景与选型建议

vitexsoftware/pohoda-connector 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.42k 次下载、GitHub Stars 达 17, 最近一次更新时间为 2020 年 11 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 vitexsoftware/pohoda-connector 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 vitexsoftware/pohoda-connector 我们能提供哪些服务?
定制开发 / 二次开发

基于 vitexsoftware/pohoda-connector 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 7.42k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 17
  • 点击次数: 14
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 17
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-11-10