From ab390f6bf17181b3fd06188cda3511073ea8fce7 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 31 Dec 2024 01:50:29 +0100 Subject: [PATCH 1/2] GitHubDriver::getFundingInfo(): order the cases This re-orders the cases in the `switch` to follow the same order as the GitHub documentation (largely alphabetic) for easier comparisons between the two lists. Refs: * https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository --- src/Composer/Repository/Vcs/GitHubDriver.php | 34 ++++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Composer/Repository/Vcs/GitHubDriver.php b/src/Composer/Repository/Vcs/GitHubDriver.php index 97a334f94..333410da3 100644 --- a/src/Composer/Repository/Vcs/GitHubDriver.php +++ b/src/Composer/Repository/Vcs/GitHubDriver.php @@ -257,36 +257,36 @@ class GitHubDriver extends VcsDriver foreach ($result as $key => $item) { switch ($item['type']) { - case 'tidelift': - $result[$key]['url'] = 'https://tidelift.com/funding/github/' . $item['url']; + case 'community_bridge': + $result[$key]['url'] = 'https://funding.communitybridge.org/projects/' . basename($item['url']); break; case 'github': $result[$key]['url'] = 'https://github.com/' . basename($item['url']); break; - case 'patreon': - $result[$key]['url'] = 'https://www.patreon.com/' . basename($item['url']); - break; - case 'otechie': - $result[$key]['url'] = 'https://otechie.com/' . basename($item['url']); - break; - case 'open_collective': - $result[$key]['url'] = 'https://opencollective.com/' . basename($item['url']); - break; - case 'liberapay': - $result[$key]['url'] = 'https://liberapay.com/' . basename($item['url']); + case 'issuehunt': + $result[$key]['url'] = 'https://issuehunt.io/r/' . $item['url']; break; case 'ko_fi': $result[$key]['url'] = 'https://ko-fi.com/' . basename($item['url']); break; - case 'issuehunt': - $result[$key]['url'] = 'https://issuehunt.io/r/' . $item['url']; + case 'liberapay': + $result[$key]['url'] = 'https://liberapay.com/' . basename($item['url']); break; - case 'community_bridge': - $result[$key]['url'] = 'https://funding.communitybridge.org/projects/' . basename($item['url']); + case 'open_collective': + $result[$key]['url'] = 'https://opencollective.com/' . basename($item['url']); + break; + case 'patreon': + $result[$key]['url'] = 'https://www.patreon.com/' . basename($item['url']); + break; + case 'tidelift': + $result[$key]['url'] = 'https://tidelift.com/funding/github/' . $item['url']; break; case 'buy_me_a_coffee': $result[$key]['url'] = 'https://www.buymeacoffee.com/' . basename($item['url']); break; + case 'otechie': + $result[$key]['url'] = 'https://otechie.com/' . basename($item['url']); + break; } } From ccdfb560783dc6654b09651fb9aa495c40c0bbf7 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 31 Dec 2024 01:47:43 +0100 Subject: [PATCH 2/2] GitHubDriver::getFundingInfo(): add support for thanks.dev and polar.sh GitHub looks to have added a dedicated syntax for the thanks.dev funding platform when added to a `funding.yml` file. However, it looks like Composer does not (yet) support this syntax as can be seen from failed Packagist updates of the dev branches of the [PHP_CodeSniffer](https://packagist.org/packages/squizlabs/php_codesniffer#dev-master) and [PHPCompatibility](https://packagist.org/packages/phpcompatibility/php-compatibility) packages. The polar.sh funding platform also appears to be newly supported by GH and missing from the list. This PR fixes both. Refs: * https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository --- src/Composer/Repository/Vcs/GitHubDriver.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Composer/Repository/Vcs/GitHubDriver.php b/src/Composer/Repository/Vcs/GitHubDriver.php index 333410da3..5e773e70c 100644 --- a/src/Composer/Repository/Vcs/GitHubDriver.php +++ b/src/Composer/Repository/Vcs/GitHubDriver.php @@ -281,9 +281,15 @@ class GitHubDriver extends VcsDriver case 'tidelift': $result[$key]['url'] = 'https://tidelift.com/funding/github/' . $item['url']; break; + case 'polar': + $result[$key]['url'] = 'https://polar.sh/' . basename($item['url']); + break; case 'buy_me_a_coffee': $result[$key]['url'] = 'https://www.buymeacoffee.com/' . basename($item['url']); break; + case 'thanks_dev': + $result[$key]['url'] = 'https://thanks.dev/' . basename($item['url']); + break; case 'otechie': $result[$key]['url'] = 'https://otechie.com/' . basename($item['url']); break;