se/redmine

Redmine 访问层。可用客户端:REST API,数据库

dev-master 2013-09-14 07:41 UTC

This package is not auto-updated.

Last update: 2024-09-09 15:36:39 UTC


README

Latest Stable Version

Redmine 访问层,使用 PHP 编写。

开发分支是 master 分支。

Build Status

安装

推荐安装方式是通过 Composer

{
    "require": {
        "se/redmine": "dev-master"
    }
}

使用方法

选择一个客户端
<?php

use SE\Component\Redmine\Client\RestClient();

$client = new RestClient('www.example.org/redmine', 'apiKey=c42ahcfg');

// Or coming soon
use SE\Component\Redmine\Client\DbClient();

$client = new DbClient('www.example.org:3306', 'redmine_v21', 'user', 'pass');
所有客户端的统一 API
<?php

$repository = $client->getRepository('issues');

// Find all by criteria
$issues = $repository->findAll(array('status_id' => 'closed')); 
// $issues instanceof SE\Component\Redmine\Entity\Collection\Issues

// Find one by id & persist changes
$issue = $repository->find(2); // find by id
$issue->setSubject('New Title');
$repository->persist($issue);

// Create new Issue & save it
use SE\Component\Redmine\Entity\Issue;

$issue = new Issue();
$issue->setSubject('My First Issue');
$repository->persist($issue);

print $issue->getId(); // returns Id of newly create Issue, similar to Doctrine

实现实体

运行测试

vendor/bin/phpunit -c phpunit.xml.dist

通过编辑 test/config.dist.php 中的常量并使用 --group=live 调用 phpunit 来运行一组针对运行中的 redmine 的测试。

vendor/bin/phpunit -c phpunit.xml.dist --group=live