• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

kbsali/php-redmine-api: A simple PHP Redmine API client, Object Oriented

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

kbsali/php-redmine-api

开源软件地址:

https://github.com/kbsali/php-redmine-api

开源编程语言:

PHP 100.0%

开源软件介绍:

PHP Redmine API

Latest Version Software License Build Status Total Downloads

A simple PHP Object Oriented wrapper for Redmine API.

Uses Redmine API.

Features

  • Follows PSR-4 conventions and coding standard: autoload friendly
  • Choose between using native cURL function or any PSR-18 http client like Guzzle for handling http connections
  • API entry points implementation state:
    • ✔️ Attachments
    • ✔️ Groups
    • ✔️ Custom Fields
    • ✔️ Issues
    • ✔️ Issue Categories
    • ✔️ Issue Priorities
    • Issue Relations - only partially implemented
    • ✔️ Issue Statuses
    • ✔️ News
    • ✔️ Projects
    • ✔️ Project Memberships
    • ✔️ Queries
    • ✔️ Roles
    • ✔️ Time Entries
    • ✔️ Time Entry Activities
    • ✔️ Trackers
    • ✔️ Users
    • ✔️ Versions
    • ✔️ Wiki

Todo

Limitations / Missing Redmine-API

Redmine is missing some APIs for a full remote management of the data:

A possible solution to this would be to create an extra APIs implementing the missing entry points. See existing effort in doing so: https://github.com/rschobbert/redmine-miss-api

Requirements

  • PHP ^7.4 || ^8.0
  • The PHP SimpleXML extension
  • The PHP JSON extension
  • "Enable REST web service" for your Redmine project (/settings/edit?tab=authentication)
  • then obtain your API access key in your profile page : /my/account
  • or use your username & password (not recommended)

Optional

  • The PHP cURL extension if you want to use the native cURL functions.
  • PHPUnit >= 9.0 (optional) to run the test suite

Install

Composer

Composer users can simply run:

$ php composer.phar require kbsali/redmine-api

at the root of their projects. To utilize the library, include Composer's vendor/autoload.php in the scripts that will use the Redmine classes.

For example,

<?php
// This file is generated by Composer
require_once 'vendor/autoload.php';

$client = new \Redmine\Client\NativeCurlClient('http://redmine.example.com', 'username', 'password');

Manual

It is also possible to install the library oneself, either locally to a project or globally; say, in /usr/share/php.

Download the library from php-download.com. The advantage of using this site is that no Composer installation is required. This service will resolve all composer dependencies for you and create a zip archive with vendor/autoload.php for you.

Than extract the library somewhere. For example, the following steps extract v1.6.0 of the library into the vendor/php-redmine-api-1.6.0 directory:

$ unzip kbsali_redmine_api_1.6.0.0_require.zip
$ rm kbsali_redmine_api_1.6.0.0_require.zip

Now, in any scripts that will use the Redmine classes, include the vendor/autoload.php file from the php-redmine-api directory. For example,

<?php
// This file ships with php-redmine-api
require 'vendor/php-redmine-api-1.6.0/vendor/autoload.php';

$client = new \Redmine\Client\NativeCurlClient('http://redmine.example.com', 'username', 'password');

Running the test suite

You can run test suite to make sure the library will work properly on your system. Simply run vendor/bin/phpunit in the project's directory :

$ vendor/bin/phpunit
PHPUnit 9.5.4 by Sebastian Bergmann and contributors.

Warning:       No code coverage driver available

...............................................................  63 / 432 ( 14%)
............................................................... 126 / 432 ( 29%)
............................................................... 189 / 432 ( 43%)
............................................................... 252 / 432 ( 58%)
............................................................... 315 / 432 ( 72%)
............................................................... 378 / 432 ( 87%)
......................................................          432 / 432 (100%)

Time: 00:00.149, Memory: 14.00 MB

OK (432 tests, 1098 assertions)

Basic usage of php-redmine-api client

Start your project

Create your project e.g. in the index.php by require the vendor/autoload.php file.

+<?php
+
+require_once 'vendor/autoload.php';

Instantiate a Redmine Client

You can choose between:

  1. a native curl client or
  2. the PSR-18 compatible client.

1. Native curl Client Redmine\Client\NativeCurlClient


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap