pdapps/kanbani-data
Composer 安装命令:
composer require pdapps/kanbani-data
包简介
Kanbani data parsers for PHP
关键字:
README 文档
README
These scripts enable interop with Kanbani - a free task manager for Android. In particular, they are used in Kanbani Web Viewer - a simple Trello-like Kanbani board browser.
composer require pdapps/kanbani-data
Requirements
- PHP 5.6 or 7.x
openssl(if working with encrypted profiles)
What's inside
Scripts are independent. You can include only those that you need.
sync.php - sync data manipulation
Provides set of classes that allow reading and writing (unserializing and serializing) data produced by the Kanbani when doing sync (using any transport such as local file or WebDAV).
If the openssl PHP module is available, you can manipulate encrypted sync data as well as plain.
// Creating a sync file from scratch: $syncData = new Kanbani\SyncData; $syncData->boards = [$board1, $board2, ...]; $syncData->serializeFile('foobar.kanbani'); // Or, encrypted: $syncData->serializeFile('foobar.kanbani', "TheSecretString"); // Reading an existing sync file: $syncData = new Kanbani\SyncData; $syncData->unserializeFile('foobar.kanbani'); // Or, if encrypted: $syncData->unserializeFile('foobar.kanbani', "TheSecretString", "sOmOzK..."); echo count($syncData->boards); // Can also chain like so: $syncData = (new Kanbani\SyncData($boards)) ->serializeFile(...); $syncData = (new Kanbani\SyncData) ->unserializeFile(...);
Under the hood, SyncData is using SyncFile - a class that doesn't know what exactly it is serializing, only that it is some string. You can use the two separately:
// Get plain text JSON: // {"sync_version": 1, "client_version": 1, "boards": [...]} echo json_encode($syncData); // Get CSV (to read back CSV use Kanbani Web Viewer's import plugin): // board;agEi...P4F7;1577836800000;"Welcome Board"; echo $syncData->serializeToCSV();
Assuming that $object is in the format described here:
// Creating a sync file from scratch: $data = json_encode($object); (new Kanbani\SyncFile)->serializeFile("foobar.kanbani", $data); // Reading an existing sync file: $sync = (new Kanbani\SyncFile)->unserializeFile("foobar.kanbani"); $object = json_decode($sync->data); // Reading file info only (faster, doesn't parse the data): $syncFile = (new Kanbani\SyncFile)->unserializeHeader(file_get_contents(...)); echo $syncFile->isEncrypted() ? "Encrypted data" : "Plain text";
Helper methods
SyncFile can generate Kanbani-compatible files names for encrypted boards:
$syncFile = new Kanbani\SyncFile; $syncFile->secret = "TheSecretString"; $syncFile->boardID = "sOmOzK..."; echo $syncFile->encryptedFileName(), ".kanbani";
SyncData can serialize (export) data in several other formats (it can't import them, see Kanbani Web Viewer's import plugin for that):
$syncData->serializeToJSON(); // plain text JSON $syncData->serializeToCSV(); // CSV format similar to Trello $syncData->serializeToExcelCSV(); // CSV compatible with MS Excel
Command line usage
Call sync.php directly from the command line to unserialize and dump a file (useful for debugging):
php sync.php Board.kanbani [secret board-id]
qrcode.php - QR code data manipulation
Provides set of classes that represent Kanbani's sync profile data when encoded as a QR code for sharing with other devices. It identifies the transport, server location, encryption settings and so on.
Note: a QR code holds JSON data; these classes work on such data but they do not scan or generate QR code images - use libraries like phpqrcode for that.
Generating QR code data from scratch:
$qrCode = new Kanbani\QrCodeData; $qrCode->title = "Generated sync profile"; $baseURL = "https://deep.secret/kanbani/"; $auth = new Kanbani\QrCodePassword("PDApps", "4Ever!"); $qrCode->transport = new Kanbani\QrCodeSFTP($baseURL, $auth); $data = json_encode($qrCode); // $data can now be encoded as an image: require_once "phpqrcode.php"; QRcode::png($data);
Parsing QR code data:
$qrCode = new Kanbani\QrCodeData; $qrCode->unserialize(json_decode($data)); echo $qrCode->title; echo get_class($qrCode->transport);
Helper methods
Some QrCodeWebTransports have testConnection() method that returns null on success or array ["id", "msg"] (error identifier and human readable message) - useful for checking user input.
$dav = new QrCodeWebDAV("https://dav.user.pdapps.org", null /*no auth*/); $error = $dav->testConnection(); if ($error) { echo "Problem '$error[0]': $error[1]"; } else { echo "Connection test OK!"; }
pdapps/kanbani-data 适用场景与选型建议
pdapps/kanbani-data 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 09 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「kanbani」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 pdapps/kanbani-data 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pdapps/kanbani-data 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-09-22