From 8a3a5972bf4ec98c5d21e9286d1de30ba874fc96 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 15 Dec 2014 08:45:25 -0500 Subject: [PATCH 1/8] Mention SimpleXML and JSON extension requirements in the README. --- README.markdown | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index bb9d9c60..9109d079 100644 --- a/README.markdown +++ b/README.markdown @@ -45,7 +45,10 @@ A possible solution to this would be to create an extra APIs implementing the mi ## Requirements -* PHP >= 5.3.2 with [cURL](http://php.net/manual/en/book.curl.php) extension, +* PHP >= 5.3.2 +* The PHP [cURL](http://php.net/manual/en/book.curl.php) extension +* The PHP [SimpleXML](http://php.net/manual/en/book.simplexml.php) extension +* The PHP [JSON](http://php.net/manual/en/book.json.php) 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* From 6775834b06759fd7f652bf667cd106b383ac34bc Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 15 Dec 2014 08:49:13 -0500 Subject: [PATCH 2/8] Add lib/autoload.php to allow manual (i.e. without composer) installation. The custom autoloader created by this commit translates class names into filesystem locations by a simple rule: it replaces backslashes with frontslashes, and adds ".php" on the end. Two locations are searched for this class implementation file: first we check under lib/, then under test/. The existing test/bootstrap.php checked for vendor/autoload.php and would show an error to the user if it did not exist. Now that we have our own autoloader, we can just use that instead. So, test/bootstrap.php was removed, and phpunit.xml.dist was pointed at the new lib/autoload.php for its bootstrap code. Thanks to Artur Weigandt for the implementation of the autoloader. --- lib/autoload.php | 31 +++++++++++++++++++++++++++++++ phpunit.xml.dist | 2 +- test/bootstrap.php | 18 ------------------ 3 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 lib/autoload.php delete mode 100644 test/bootstrap.php diff --git a/lib/autoload.php b/lib/autoload.php new file mode 100644 index 00000000..061a8789 --- /dev/null +++ b/lib/autoload.php @@ -0,0 +1,31 @@ + diff --git a/test/bootstrap.php b/test/bootstrap.php deleted file mode 100644 index 5ea1025c..00000000 --- a/test/bootstrap.php +++ /dev/null @@ -1,18 +0,0 @@ -add('Redmine\Tests', __DIR__); - -return $loader; From edaf7e2aaf8f641098c76dbf6c708c228c562ddd Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 16 Dec 2014 09:41:13 -0500 Subject: [PATCH 3/8] Use consistent indentation in bullet lists. --- README.markdown | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/README.markdown b/README.markdown index 9109d079..d2dcb0a5 100644 --- a/README.markdown +++ b/README.markdown @@ -6,8 +6,8 @@ Uses [Redmine API](http://www.redmine.org/projects/redmine/wiki/Rest_api/). ## Features -* Follows PSR-0 conventions and coding standard: autoload friendly -* API entry points implementation state : + * Follows PSR-0 conventions and coding standard: autoload friendly + * API entry points implementation state : * OK Attachments * OK Groups * OK Custom Fields @@ -30,26 +30,26 @@ Uses [Redmine API](http://www.redmine.org/projects/redmine/wiki/Rest_api/). ## Todo -* Check header's response code (especially for POST/PUT/DELETE requests) + * Check header's response code (especially for POST/PUT/DELETE requests) * See http://stackoverflow.com/questions/9183178/php-curl-retrieving-response-headers-and-body-in-a-single-request/9183272#9183272 -* Maybe Guzzle for handling http connections + * Maybe Guzzle for handling http connections * https://github.com/guzzle/guzzle ## Limitations Redmine is missing some APIs for a full remote management of the data : -* List of activities & roles : http://www.redmine.org/issues/11464 -* ... + * List of activities & roles : http://www.redmine.org/issues/11464 + * ... 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 >= 5.3.2 -* The PHP [cURL](http://php.net/manual/en/book.curl.php) extension -* The PHP [SimpleXML](http://php.net/manual/en/book.simplexml.php) extension -* The PHP [JSON](http://php.net/manual/en/book.json.php) extension -* "Enable REST web service" for your Redmine project (/settings/edit?tab=authentication) + * PHP >= 5.3.2 + * The PHP [cURL](http://php.net/manual/en/book.curl.php) extension + * The PHP [SimpleXML](http://php.net/manual/en/book.simplexml.php) extension + * The PHP [JSON](http://php.net/manual/en/book.json.php) 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* @@ -110,7 +110,7 @@ $client->setImpersonateUser(null); ### Thanks! -* Thanks to [Thomas Spycher](https://github.com/tspycher/) for the 1st version of the class. -* Thanks to [Thibault Duplessis aka. ornicar](https://github.com/ornicar) for the php-github-api library, great source of inspiration! -* And all the [contributors](https://github.com/kbsali/php-redmine-api/graphs/contributors) - * specially [JanMalte](https://github.com/JanMalte) for his impressive contribution to the test coverage! :) \ No newline at end of file + * Thanks to [Thomas Spycher](https://github.com/tspycher/) for the 1st version of the class. + * Thanks to [Thibault Duplessis aka. ornicar](https://github.com/ornicar) for the php-github-api library, great source of inspiration! + * And all the [contributors](https://github.com/kbsali/php-redmine-api/graphs/contributors) + * specially [JanMalte](https://github.com/JanMalte) for his impressive contribution to the test coverage! :) From 839c3383cc70bf76d5db692ef88c1f46270bd586 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 16 Dec 2014 10:03:28 -0500 Subject: [PATCH 4/8] Add documentation for the manual installation method to the README. --- README.markdown | 51 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/README.markdown b/README.markdown index d2dcb0a5..003033de 100644 --- a/README.markdown +++ b/README.markdown @@ -55,20 +55,65 @@ A possible solution to this would be to create an extra APIs implementing the mi ## Install -Through [composer](http://getcomposer.org/download/), simply run : +### Composer + +[Composer](http://getcomposer.org/download/) users can simply run: ```bash $ php composer.phar require kbsali/redmine-api:~1.0 ``` +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 +api('issue')->all([ ]); ``` -see `example.php` +See `example.php` for further examples. ## User Impersonation From 3dbd09cbecec2f613be4d376658440bc48796e34 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 16 Dec 2014 10:05:30 -0500 Subject: [PATCH 5/8] Update the PHP version requirement in the README per composer.json. --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 003033de..86d5f158 100644 --- a/README.markdown +++ b/README.markdown @@ -45,7 +45,7 @@ A possible solution to this would be to create an extra APIs implementing the mi ## Requirements - * PHP >= 5.3.2 + * PHP >= 5.4 * The PHP [cURL](http://php.net/manual/en/book.curl.php) extension * The PHP [SimpleXML](http://php.net/manual/en/book.simplexml.php) extension * The PHP [JSON](http://php.net/manual/en/book.json.php) extension From 8399353c130696365c457dd5597494915cf33df0 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 16 Dec 2014 10:12:46 -0500 Subject: [PATCH 6/8] Add requirements/instructions for running the test suite to the README. --- README.markdown | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.markdown b/README.markdown index 86d5f158..6af7b1e7 100644 --- a/README.markdown +++ b/README.markdown @@ -49,6 +49,7 @@ A possible solution to this would be to create an extra APIs implementing the mi * The PHP [cURL](http://php.net/manual/en/book.curl.php) extension * The PHP [SimpleXML](http://php.net/manual/en/book.simplexml.php) extension * The PHP [JSON](http://php.net/manual/en/book.json.php) extension + * [PHPUnit](https://phpunit.de/) >= 4.0 (optional) to run the test suite * "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* @@ -103,6 +104,28 @@ require 'vendor/php-redmine-api-1.5.1/lib/autoload.php'; $client = new Redmine\Client('http://redmine.example.com', 'username', 'password'); ``` +### Running the test suite + +If you have [PHPUnit](https://phpunit.de/) >= 4.0 installed, you can +run the test suite to make sure that the library will function +properly on your system. Simply run `phpunit` in the php-redmine-api +directory. For example, + +``` +$ phpunit +PHPUnit 4.3.1 by Sebastian Bergmann. + +Configuration read from ./phpunit.xml.dist + +............................................................... 63 / 276 ( 22%) +............................................................... 126 / 276 ( 45%) +............................................................... 189 / 276 ( 68%) +............................................................... 252 / 276 ( 91%) +........................ + +Time: 591 ms, Memory: 10.50Mb +``` + ## Basic usage of `php-redmine-api` client ```php From 1622985e14bfd4037d1419d3dabfc3625ebb1358 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 22 Dec 2014 14:42:23 -0500 Subject: [PATCH 7/8] Reduce bullet indentation one level in the README. --- README.markdown | 78 ++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/README.markdown b/README.markdown index 6af7b1e7..5306fd39 100644 --- a/README.markdown +++ b/README.markdown @@ -6,53 +6,53 @@ Uses [Redmine API](http://www.redmine.org/projects/redmine/wiki/Rest_api/). ## Features - * Follows PSR-0 conventions and coding standard: autoload friendly - * API entry points implementation state : - * OK Attachments - * OK Groups - * OK Custom Fields - * OK Issues - * OK Issue Categories - * OK Issue Priorities - * *NOK Issue Relations - only partially implemented* - * OK Issue Statuses - * OK News - * OK Projects - * OK Project Memberships - * OK Queries - * OK Roles - * OK Time Entries - * OK Time Entry Activities - * OK Trackers - * OK Users - * OK Versions - * OK Wiki +* Follows PSR-0 conventions and coding standard: autoload friendly +* API entry points implementation state : +* OK Attachments +* OK Groups +* OK Custom Fields +* OK Issues +* OK Issue Categories +* OK Issue Priorities +* *NOK Issue Relations - only partially implemented* +* OK Issue Statuses +* OK News +* OK Projects +* OK Project Memberships +* OK Queries +* OK Roles +* OK Time Entries +* OK Time Entry Activities +* OK Trackers +* OK Users +* OK Versions +* OK Wiki ## Todo - * Check header's response code (especially for POST/PUT/DELETE requests) - * See http://stackoverflow.com/questions/9183178/php-curl-retrieving-response-headers-and-body-in-a-single-request/9183272#9183272 - * Maybe Guzzle for handling http connections - * https://github.com/guzzle/guzzle +* Check header's response code (especially for POST/PUT/DELETE requests) +* See http://stackoverflow.com/questions/9183178/php-curl-retrieving-response-headers-and-body-in-a-single-request/9183272#9183272 +* Maybe Guzzle for handling http connections +* https://github.com/guzzle/guzzle ## Limitations Redmine is missing some APIs for a full remote management of the data : - * List of activities & roles : http://www.redmine.org/issues/11464 - * ... +* List of activities & roles : http://www.redmine.org/issues/11464 +* ... 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 >= 5.4 - * The PHP [cURL](http://php.net/manual/en/book.curl.php) extension - * The PHP [SimpleXML](http://php.net/manual/en/book.simplexml.php) extension - * The PHP [JSON](http://php.net/manual/en/book.json.php) extension - * [PHPUnit](https://phpunit.de/) >= 4.0 (optional) to run the test suite - * "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* +* PHP >= 5.4 +* The PHP [cURL](http://php.net/manual/en/book.curl.php) extension +* The PHP [SimpleXML](http://php.net/manual/en/book.simplexml.php) extension +* The PHP [JSON](http://php.net/manual/en/book.json.php) extension +* [PHPUnit](https://phpunit.de/) >= 4.0 (optional) to run the test suite +* "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* ## Install @@ -178,7 +178,7 @@ $client->setImpersonateUser(null); ### Thanks! - * Thanks to [Thomas Spycher](https://github.com/tspycher/) for the 1st version of the class. - * Thanks to [Thibault Duplessis aka. ornicar](https://github.com/ornicar) for the php-github-api library, great source of inspiration! - * And all the [contributors](https://github.com/kbsali/php-redmine-api/graphs/contributors) - * specially [JanMalte](https://github.com/JanMalte) for his impressive contribution to the test coverage! :) +* Thanks to [Thomas Spycher](https://github.com/tspycher/) for the 1st version of the class. +* Thanks to [Thibault Duplessis aka. ornicar](https://github.com/ornicar) for the php-github-api library, great source of inspiration! +* And all the [contributors](https://github.com/kbsali/php-redmine-api/graphs/contributors) +* specially [JanMalte](https://github.com/JanMalte) for his impressive contribution to the test coverage! :) From 4f0a6bc2ed97d0d56561be6b3febd01fdbc6fde4 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 22 Dec 2014 14:54:09 -0500 Subject: [PATCH 8/8] Whitespace fixes in lib/autoload.php. * Use four spaces for indentation of "if" statements. * Add a space between parenthesis and braces, e.g. if (foo) {... * Remove spaces around the string concatenation operator (dot). This is consistent with its usage in Redmine/Client.php. --- lib/autoload.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/autoload.php b/lib/autoload.php index 061a8789..2ae866b6 100644 --- a/lib/autoload.php +++ b/lib/autoload.php @@ -16,16 +16,16 @@ * we look here first, so that we don't waste time searching for * test classes in the common case. */ - $path = dirname(__FILE__) . '/' . $class . '.php'; - if (file_exists($path)){ - require_once($path); + $path = dirname(__FILE__).'/'.$class.'.php'; + if (file_exists($path)) { + require_once($path); } /* If we didn't find what we're looking for already, maybe it's * a test class? */ - $path = dirname(__FILE__) . '/../test/' . $class . '.php'; - if (file_exists($path)){ - require_once($path); + $path = dirname(__FILE__).'/../test/'.$class.'.php'; + if (file_exists($path)) { + require_once($path); } });