@@ -8,32 +8,32 @@ Uses [Redmine API](http://www.redmine.org/projects/redmine/wiki/Rest_api/).
88
99* Follows PSR-0 conventions and coding standard: autoload friendly
1010* 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
3030
3131## Todo
3232
3333* 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
3535* Maybe Guzzle for handling http connections
36- * https://github.com/guzzle/guzzle
36+ * https://github.com/guzzle/guzzle
3737
3838## Limitations
3939
@@ -45,27 +45,98 @@ A possible solution to this would be to create an extra APIs implementing the mi
4545
4646## Requirements
4747
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
4953* "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*
5256
5357## Install
5458
55- Through [ composer] ( http://getcomposer.org/download/ ) , simply run :
59+ ### Composer
60+
61+ [ Composer] ( http://getcomposer.org/download/ ) users can simply run:
5662
5763``` bash
5864$ php composer.phar require kbsali/redmine-api:~ 1.0
5965```
6066
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+
61129## Basic usage of ` php-redmine-api ` client
62130
63131``` php
64132<?php
65133
66- // This file is generated by Composer
134+ // For Composer users (this file is generated by Composer)
67135require_once 'vendor/autoload.php';
68136
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+
69140$client = new Redmine\Client('http://redmine.example.com', 'API_ACCESS_KEY');
70141//-- OR --
71142$client = new Redmine\Client('http://redmine.example.com', 'username', 'password');
@@ -84,7 +155,7 @@ $client->api('issue')->all([
84155]);
85156```
86157
87- see ` example.php `
158+ See ` example.php ` for further examples.
88159
89160## User Impersonation
90161
@@ -110,4 +181,4 @@ $client->setImpersonateUser(null);
110181* Thanks to [ Thomas Spycher] ( https://github.com/tspycher/ ) for the 1st version of the class.
111182* Thanks to [ Thibault Duplessis aka. ornicar] ( https://github.com/ornicar ) for the php-github-api library, great source of inspiration!
112183* 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