Download the PHP package kbsali/redmine-api without Composer
On this page you can find all versions of the php package kbsali/redmine-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kbsali/redmine-api
More information about kbsali/redmine-api
Files in kbsali/redmine-api
Package redmine-api
Short Description Redmine API client
License MIT
Homepage https://github.com/kbsali/php-redmine-api
Rated 3.67 based on 3 reviews
Informations about the package redmine-api
PHP Redmine API
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 implementation like Guzzle for handling http connections -
mid-level API e.g.
- low-level API e.g.
Supported Redmine versions
We support (and run tests against) the latest supported Redmine versions that receive security updates.
- Redmine 5.1.x
- Redmine 5.0.x
- Redmine 4.2.x
Nevertheless, you can also use this library for all older Redmine versions. In this case, however, be aware that some features might not be supported by your Redmine server.
If a new Redmine version enables new features that are not yet supported with this library, you are welcome to create an issue.
Requirements
- PHP ^7.4 || ^8.0
- The PHP SimpleXML extension
- The PHP JSON extension
- Enabled REST web service on your Redmine server
- Go to Administration -> Settings -> Api (
/settings/edit?tab=api
) and check the "Enable REST web service" box - Obtain your API access key in your profile page:
/my/account
- (or use your username & password; not recommended)
- Go to Administration -> Settings -> Api (
Optional
- The PHP cURL extension if you want to use the native
cURL
functions. - PHPUnit >= 9.0 (optional) to run the test suite
Todo
- Tracking of Redmine API feature support in #305
- Check header's response code (especially for POST/PUT/DELETE requests)
Limitations / Missing Redmine-API
Redmine is missing some APIs for a full remote management of the data:
- List of activities & roles: https://www.redmine.org/issues/11464
- Open issues because of missing Redmine API
Install
By using Composer you can simply run:
at the root of your projects. To utilize the library, include
Composer's vendor/autoload.php
in the scripts that will use the
Redmine
classes.
For example,
For a manual installation please follow this instruction.
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 :
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.
Instantiate a Redmine Client
You can choose between:
- a native curl client or
- the PSR-18 compatible client.
1. Native curl Client Redmine\Client\NativeCurlClient
:bulb: This client was introduced in
php-redmine-api
v1.8.0. If you are using the oldRedmine\Client
please see this migration guide for help to upgrade your code.
You will need a URL to your Redmine instance and either a valid Apikey...
... or valid username/password.
:bulb: For security reason it is recommended that you use an ApiKey rather than your username/password.
cURL configuration
After you instantiate a client you can set some optional cURL
settings.
2. Psr-18 compatible Client Redmine\Client\Psr18Client
:bulb: This client was introduced in
v1.7.0
of this library. If you are using the oldRedmine\Client
please follow this migration guide.
The Psr18Client
requires
- a
Psr\Http\Client\ClientInterface
implementation (like guzzlehttp/guzzle), see - a
Psr\Http\Message\RequestFactoryInterface
implementation (like guzzlehttp/psr7), see - a
Psr\Http\Message\StreamFactoryInterface
implementation (like guzzlehttp/psr7), see - a URL to your Redmine instance
- an Apikey or username
- and optional a password if you want tu use username/password.
:bulb: For security reason it is recommended that you use an ApiKey rather than your username/password.
Guzzle configuration
Because the Psr18Client
is agnostic about the HTTP client implementation every configuration specific to the transport has to be set to the Psr\Http\Client\ClientInterface
implementation.
This means that if you want to set any cURL
settings to Guzzle
you have multiple ways to set them:
- Using Guzzle environment variables
- Using request options inside a
Psr\Http\Client\ClientInterface
wrapper:
Built-in Redmine features
Impersonate User
Redmine allows you to impersonate another user. This can be done using the methods startImpersonateUser()
and stopImpersonateUser()
.
API usage
You can now use the getApi()
method to create and get a specific Redmine API.
See further examples and read more about usage in the docs.
Thanks!
- Thanks to Thomas Spycher for the 1st version of the class.
- Thanks to Thibault Duplessis aka. ornicar for the php-github-api library, great source of inspiration!
- And all the contributors
- specially JanMalte for his impressive contribution to the test coverage! :)
All versions of redmine-api with dependencies
ext-curl Version *
ext-simplexml Version *
ext-json Version *
psr/http-client Version ^1.0
psr/http-factory Version ^1.0