ninlaret/task-syncer-app

此包的最新版本(v1.0.2)没有可用的许可信息。

任务同步器项目模板

v1.0.2 2022-08-18 17:12 UTC

This package is auto-updated.

Last update: 2024-09-18 21:50:39 UTC


README

任务同步器项目模板

一个用于在不同任务系统之间同步任务的简单应用程序。

它包含对三个任务系统的实现:notion、gitlab 和 habitica,您可以添加更多您需要的系统。

目录结构

  app/                contains system realizations
   - controller/      contains custom controller for webkooks
   - system/          contains local realizations of task systems
  config/             contains application configurations

要求

本项目模板对您的 Web 服务器最低要求是支持 PHP 8.0

安装

通过 Composer 安装

如果您没有 Composer,您可以通过遵循 getcomposer.org 上的说明来安装它。

运行以下命令安装应用程序模板

composer create-project --prefer-dist ninlaret/task-syncer-app .

如果您预计将使用任何任务器 Webhook,您必须选择一个可公开访问的文件夹和一个具有 Web 服务器和公共 IP 的主机。

配置

数据库

使用实际数据编辑 config/params.php 文件,例如

return [
    'dbName' => 'tasker',
    'dbUser' => 'user',
    'dbPassword' => 'password',
    ...
];

您应该在此部分添加一个现有的数据库。

同步设置

首先,您必须在 config/params.php 文件中的 apiRealisations 部分添加您所有的系统。任何 API 的实现都应该与 core\system\ApiSystem 类兼容。所有令牌也可以放入 config/params.php

然后,您需要编辑 config/cli.phpconfig/web.php 文件中的 syncParams 部分,例如

'syncParams' => [
    'target' => [
        'gitlab' => ['notion'],
        'notion' => ['habitica'],
    ],
]

这意味着将 Gitlab 中的所有任务同步到 notion,并将 notion 中的所有任务同步到 habitica。

用法

要从 cli 同步系统,请运行以下命令

cli sync

要使用 Webhook,请添加 app\controller\CustomController 动作方法。例如,方法 CustomController::habiticaAction() 通过 http://your_app_host/habitica url 可用。