@@ -8,32 +8,32 @@ Uses [Redmine API](http://www.redmine.org/projects/redmine/wiki/Rest_api/).
8
8
9
9
* Follows PSR-0 conventions and coding standard: autoload friendly
10
10
* API entry points implementation state :
11
- * OK Attachments
12
- * OK Groups
13
- * OK Custom Fields
14
- * OK Issues
15
- * OK Issue Categories
16
- * OK Issue Priorities
17
- * * NOK Issue Relations - only partially implemented*
18
- * OK Issue Statuses
19
- * OK News
20
- * OK Projects
21
- * OK Project Memberships
22
- * OK Queries
23
- * OK Roles
24
- * OK Time Entries
25
- * OK Time Entry Activities
26
- * OK Trackers
27
- * OK Users
28
- * OK Versions
29
- * OK Wiki
11
+ * OK Attachments
12
+ * OK Groups
13
+ * OK Custom Fields
14
+ * OK Issues
15
+ * OK Issue Categories
16
+ * OK Issue Priorities
17
+ * * NOK Issue Relations - only partially implemented*
18
+ * OK Issue Statuses
19
+ * OK News
20
+ * OK Projects
21
+ * OK Project Memberships
22
+ * OK Queries
23
+ * OK Roles
24
+ * OK Time Entries
25
+ * OK Time Entry Activities
26
+ * OK Trackers
27
+ * OK Users
28
+ * OK Versions
29
+ * OK Wiki
30
30
31
31
## Todo
32
32
33
33
* Check header's response code (especially for POST/PUT/DELETE requests)
34
- * See http://stackoverflow.com/questions/9183178/php-curl-retrieving-response-headers-and-body-in-a-single-request/9183272#9183272
34
+ * See http://stackoverflow.com/questions/9183178/php-curl-retrieving-response-headers-and-body-in-a-single-request/9183272#9183272
35
35
* Maybe Guzzle for handling http connections
36
- * https://github.com/guzzle/guzzle
36
+ * https://github.com/guzzle/guzzle
37
37
38
38
## Limitations
39
39
@@ -45,27 +45,98 @@ A possible solution to this would be to create an extra APIs implementing the mi
45
45
46
46
## Requirements
47
47
48
- * PHP >= 5.3.2 with [ cURL] ( http://php.net/manual/en/book.curl.php ) extension,
48
+ * PHP >= 5.4
49
+ * The PHP [ cURL] ( http://php.net/manual/en/book.curl.php ) extension
50
+ * The PHP [ SimpleXML] ( http://php.net/manual/en/book.simplexml.php ) extension
51
+ * The PHP [ JSON] ( http://php.net/manual/en/book.json.php ) extension
52
+ * [ PHPUnit] ( https://phpunit.de/ ) >= 4.0 (optional) to run the test suite
49
53
* "Enable REST web service" for your Redmine project (/settings/edit?tab=authentication)
50
- * then obtain your * API access key* in your profile page : /my/account
51
- * or use your * username & password*
54
+ * then obtain your * API access key* in your profile page : /my/account
55
+ * or use your * username & password*
52
56
53
57
## Install
54
58
55
- Through [ composer] ( http://getcomposer.org/download/ ) , simply run :
59
+ ### Composer
60
+
61
+ [ Composer] ( http://getcomposer.org/download/ ) users can simply run:
56
62
57
63
``` bash
58
64
$ php composer.phar require kbsali/redmine-api:~ 1.0
59
65
```
60
66
67
+ at the root of their projects. To utilize the library, include
68
+ Composer's ` vendor/autoload.php ` in the scripts that will use the
69
+ ` Redmine ` classes.
70
+
71
+ For example,
72
+
73
+ ``` php
74
+ <?php
75
+ // This file is generated by Composer
76
+ require_once 'vendor/autoload.php';
77
+ $client = new Redmine\Client('http://redmine.example.com', 'username', 'password');
78
+ ```
79
+
80
+ ### Manual
81
+
82
+ It is also possible to install the library oneself, either locally to
83
+ a project or globally; say, in ` /usr/share/php ` .
84
+
85
+ First, download and extract the library somewhere. For example, the
86
+ following steps extract v1.5.1 of the library into the
87
+ ` vendor/php-redmine-api-1.5.1 ` directory:
88
+
89
+ ``` bash
90
+ $ mkdir vendor
91
+ $ wget -q https://github.com/kbsali/php-redmine-api/archive/v1.5.1.tar.gz
92
+ $ tar -xf v1.5.1.tar.gz -C vendor/
93
+ $ rm v1.5.1.tar.gz
94
+ ```
95
+
96
+ Now, in any scripts that will use the ` Redmine ` classes, include the
97
+ ` lib/autoload.php ` file from the php-redmine-api directory. For
98
+ example,
99
+
100
+ ``` php
101
+ <?php
102
+ // This file ships with php-redmine-api
103
+ require 'vendor/php-redmine-api-1.5.1/lib/autoload.php';
104
+ $client = new Redmine\Client('http://redmine.example.com', 'username', 'password');
105
+ ```
106
+
107
+ ### Running the test suite
108
+
109
+ If you have [ PHPUnit] ( https://phpunit.de/ ) >= 4.0 installed, you can
110
+ run the test suite to make sure that the library will function
111
+ properly on your system. Simply run ` phpunit ` in the php-redmine-api
112
+ directory. For example,
113
+
114
+ ```
115
+ $ phpunit
116
+ PHPUnit 4.3.1 by Sebastian Bergmann.
117
+
118
+ Configuration read from ./phpunit.xml.dist
119
+
120
+ ............................................................... 63 / 276 ( 22%)
121
+ ............................................................... 126 / 276 ( 45%)
122
+ ............................................................... 189 / 276 ( 68%)
123
+ ............................................................... 252 / 276 ( 91%)
124
+ ........................
125
+
126
+ Time: 591 ms, Memory: 10.50Mb
127
+ ```
128
+
61
129
## Basic usage of ` php-redmine-api ` client
62
130
63
131
``` php
64
132
<?php
65
133
66
- // This file is generated by Composer
134
+ // For Composer users (this file is generated by Composer)
67
135
require_once 'vendor/autoload.php';
68
136
137
+ // Or if you've installed the library manually, use this instead.
138
+ // require 'vendor/php-redmine-api-x.y.z/lib/autoload.php';
139
+
69
140
$client = new Redmine\Client('http://redmine.example.com', 'API_ACCESS_KEY');
70
141
//-- OR --
71
142
$client = new Redmine\Client('http://redmine.example.com', 'username', 'password');
@@ -84,7 +155,7 @@ $client->api('issue')->all([
84
155
]);
85
156
```
86
157
87
- see ` example.php `
158
+ See ` example.php ` for further examples.
88
159
89
160
## User Impersonation
90
161
@@ -110,4 +181,4 @@ $client->setImpersonateUser(null);
110
181
* Thanks to [ Thomas Spycher] ( https://github.com/tspycher/ ) for the 1st version of the class.
111
182
* Thanks to [ Thibault Duplessis aka. ornicar] ( https://github.com/ornicar ) for the php-github-api library, great source of inspiration!
112
183
* And all the [ contributors] ( https://github.com/kbsali/php-redmine-api/graphs/contributors )
113
- * specially [ JanMalte] ( https://github.com/JanMalte ) for his impressive contribution to the test coverage! :)
184
+ * specially [ JanMalte] ( https://github.com/JanMalte ) for his impressive contribution to the test coverage! :)
0 commit comments