Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [7.3, 7.4, 8.0, 8.1, 8.2]
dependency-version: [prefer-lowest, prefer-stable]
php: [8.2,8.3,8.4]
dependency-version: [prefer-stable]

name: P${{ matrix.php }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout code
uses: actions/checkout@v1
uses: actions/checkout@v4

- name: Cache dependencies
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: dependencies--php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
Expand All @@ -29,11 +29,18 @@ jobs:
with:
php-version: ${{ matrix.php }}
extensions: curl, mbstring, iconv
coverage: none
coverage: xdebug, pcov
tools: composer:v2

- name: Install dependencies
run: |
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest

- name: Execute tests
run: vendor/bin/phpunit
run: vendor/bin/phpunit --coverage-clover clover.xml

- name: Coverage Check
uses: ericsizemore/phpunit-coverage-check-action@1.0.0
with:
clover_file: 'clover.xml'
threshold: 75
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/.php_cs.cache
/.php-cs-fixer.cache
/.phpunit.result.cache
/.phpunit.cache
/build
/phpunit.xml
/phpunit.xml.dist.bak
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PHP Trello API v1 client
========================

![tests](https://github.com/semaio/php-trello-api/workflows/run-tests/badge.svg?branch=master)
![tests](https://github.com/josrom/php-trello-api/workflows/run-tests/badge.svg?branch=master)

This library is based on the great [php-trello-api](https://github.com/cdaguerre/php-trello-api/) but updated and modernized for usage with PHP 7.3+ and a modern version of Guzzle.

Expand All @@ -12,7 +12,7 @@ This library is based on the great [php-trello-api](https://github.com/cdaguerre
The recommended way is using [composer](http://getcomposer.org):

```bash
$ composer require semaio/php-trello-api
$ composer require josrom/php-trello-api
```

## Usage
Expand Down Expand Up @@ -40,7 +40,7 @@ $client->getCardApi()->create( $card );

## Support

If you encounter any problems or bugs, please create an issue on [GitHub](https://github.com/semaio/php-trello-api/issues).
If you encounter any problems or bugs, please create an issue on [GitHub](https://github.com/josrom/php-trello-api/issues).

## Contribution

Expand Down
26 changes: 13 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"name": "semaio/php-trello-api",
"name": "josrom/php-trello-api",
"type": "library",
"description": "PHP client for Trello API v1",
"keywords": [
"trello"
],
"license": "MIT",
"require": {
"php": "^7.3|^8.0|^8.1|^8.2",
"php-http/discovery": "^1.6",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
"psr/http-message-implementation": "^1.0"
"php": "^8.2|^8.3|^8.4",
"php-http/discovery": "^1.6|^2.0",
"psr/http-client": "^1.0|^2.0",
"psr/http-factory": "^1.0|^2.0",
"psr/http-message": "^1.0|^2.0",
"psr/http-message-implementation": "^1.0|^2.0"
},
"require-dev": {
"http-interop/http-factory-guzzle": "^1.0",
"php-http/guzzle6-adapter": "^2.0",
"phpunit/phpunit": "^9.0|^10.0",
"symfony/event-dispatcher": "^4.4|^5.0|^6.0",
"symfony/http-foundation": "^4.4|^5.0|^6.0",
"symplify/easy-coding-standard": "^8.0",
"symplify/config-transformer": "^10.0"
"php-http/guzzle7-adapter": "^1.1.0",
"phpunit/phpunit": "^10.0|^11.0|^12.0",
"symfony/event-dispatcher": "^4.4|^5.0|^6.0|^7.0",
"symfony/http-foundation": "^4.4|^5.0|^6.0|^7.0",
"symplify/easy-coding-standard": "^8.0|^9.0|^10.0|^11.0|^12.0",
"symplify/config-transformer": "^10.0|^11.0|^12.0"
},
"suggest": {
"symfony/event-dispatcher": "Symfony Event Dispatcher for the Trello webhook service.",
Expand Down
65 changes: 35 additions & 30 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticAttributes="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
cacheDirectory=".phpunit.cache"
executionOrder="depends,defects"
bootstrap="vendor/autoload.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage" lowUpperBound="35" highLowerBound="70"/>
</report>
</coverage>
<php>
<ini name="display_errors" value="1"/>
<ini name="error_reporting" value="-1"/>
<ini name="date.timezone" value="UTC"/>
</php>
<testsuites>
<testsuite name="unit">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<logging>
<junit outputFile="build/logs/junit.xml"/>
</logging>
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
failOnPhpunitDeprecation="true"
failOnRisky="true"
failOnWarning="true"
beStrictAboutCoverageMetadata="true"
beStrictAboutOutputDuringTests="true"
displayDetailsOnPhpunitDeprecations="true">
<coverage>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage" lowUpperBound="35" highLowerBound="70"/>
</report>
</coverage>
<php>
<ini name="display_errors" value="1"/>
<ini name="error_reporting" value="-1"/>
<ini name="date.timezone" value="UTC"/>
</php>
<testsuites>
<testsuite name="unit">
<directory>./tests</directory>
</testsuite>
</testsuites>
<source ignoreIndirectDeprecations="true"
restrictNotices="true"
restrictWarnings="true">
<include>
<directory>./src</directory>
</include>
</source>
<logging>
<junit outputFile="build/logs/junit.xml"/>
</logging>
</phpunit>
14 changes: 3 additions & 11 deletions src/Api/AbstractApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,17 @@ abstract class AbstractApi implements ApiInterface
/**
* @var array
*/
public static $fields;

/**
* The client.
*
* @var TrelloClientInterface
*/
protected $client;
public static array $fields;

/**
* API sub namespace.
*
* @var string
*/
protected $path;
protected string $path;

public function __construct(TrelloClientInterface $client)
public function __construct(protected TrelloClientInterface $client)
{
$this->client = $client;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Api/ActionApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ class ActionApi extends AbstractApi
/**
* @see https://trello.com/docs/api/action/#get-1-actions-idaction-field
*/
public static $fields = [
public static array $fields = [
'idMemberCreator',
'data',
'type',
'date',
];

protected $path = 'actions';
protected string $path = 'actions';

/**
* Find an action by id.
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Board/BoardActionsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
class BoardActionsApi extends AbstractApi
{
protected $path = 'boards/#id#/actions';
protected string $path = 'boards/#id#/actions';

/**
* Get actions related to a given board.
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Board/BoardCardListsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
class BoardCardListsApi extends AbstractApi
{
protected $path = 'boards/#id#/lists';
protected string $path = 'boards/#id#/lists';

/**
* Get a given board's lists.
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Board/BoardCardsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
class BoardCardsApi extends AbstractApi
{
protected $path = 'boards/#id#/cards';
protected string $path = 'boards/#id#/cards';

/**
* Get cards related to a given board.
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Board/BoardChecklistsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
class BoardChecklistsApi extends AbstractApi
{
protected $path = 'boards/#id#/checklists';
protected string $path = 'boards/#id#/checklists';

/**
* Get cards related to a given board.
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Board/BoardLabelsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class BoardLabelsApi extends AbstractApi
{
protected $path = 'boards/#id#/labels';
protected string $path = 'boards/#id#/labels';

/**
* Get labels related to a given board.
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Board/BoardMembersApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class BoardMembersApi extends AbstractApi
*
* @var string
*/
protected $path = 'boards/#id#/members';
protected string $path = 'boards/#id#/members';

/**
* Get a given board's members.
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Board/BoardMembershipsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ class BoardMembershipsApi extends AbstractApi
*
* @var string
*/
protected $path = 'boards/#id#/memberships';
protected string $path = 'boards/#id#/memberships';
}
2 changes: 1 addition & 1 deletion src/Api/Board/BoardMyPreferencesApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ class BoardMyPreferencesApi extends AbstractApi
*
* @var string
*/
protected $path = 'boards/#id#/myPrefs';
protected string $path = 'boards/#id#/myPrefs';
}
2 changes: 1 addition & 1 deletion src/Api/Board/BoardPowerUpsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ class BoardPowerUpsApi extends AbstractApi
*
* @var string
*/
protected $path = 'boards/#id#/powerUps';
protected string $path = 'boards/#id#/powerUps';
}
2 changes: 1 addition & 1 deletion src/Api/Board/BoardPreferencesApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ class BoardPreferencesApi extends AbstractApi
*
* @var string
*/
protected $path = 'boards/#id#/prefs';
protected string $path = 'boards/#id#/prefs';
}
4 changes: 2 additions & 2 deletions src/Api/BoardApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class BoardApi extends AbstractApi
/**
* @see https://trello.com/docs/api/board/#get-1-boards-board-id-field
*/
public static $fields = [
public static array $fields = [
'name',
'desc',
'descData',
Expand All @@ -53,7 +53,7 @@ class BoardApi extends AbstractApi
'shortUrl',
];

protected $path = 'boards';
protected string $path = 'boards';

/**
* Find a board by id.
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Card/CardActionsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
class CardActionsApi extends AbstractApi
{
protected $path = 'cards/#id#/actions';
protected string $path = 'cards/#id#/actions';

/**
* Get actions related to a given card.
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Card/CardAttachmentsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
class CardAttachmentsApi extends AbstractApi
{
protected $path = 'cards/#id#/attachments';
protected string $path = 'cards/#id#/attachments';

/**
* Get attachments related to a given card.
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Card/CardChecklistsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
class CardChecklistsApi extends AbstractApi
{
protected $path = 'cards/#id#/checklists';
protected string $path = 'cards/#id#/checklists';

/**
* Get checklists related to a given card.
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Card/CardLabelsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
class CardLabelsApi extends AbstractApi
{
protected $path = 'cards/#id#/labels';
protected string $path = 'cards/#id#/labels';

/**
* Set a given card's labels.
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Card/CardMembersApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class CardMembersApi extends AbstractApi
{
protected $path = 'cards/#id#/members';
protected string $path = 'cards/#id#/members';

/**
* Get members related to a given card.
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Card/CardStickersApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
class CardStickersApi extends AbstractApi
{
protected $path = 'cards/#id#/stickers';
protected string $path = 'cards/#id#/stickers';

/**
* Get stickers related to a given card.
Expand Down
Loading