paydemic / paydemic-php-sdk
PHP SDK for Paydemic.com REST API.
1.1.0
2018-09-24 20:07 UTC
Requires
- php: >=5.5.0
- aws/aws-sdk-php: ^3.18
- bramus/monolog-colored-line-formatter: ~2.0
- guzzlehttp/guzzle: ~6.0
- maciejczyzewski/bottomline: *
- monolog/monolog: ^1.19
Requires (Dev)
- bear/qatools: ^1.0
- phpmd/phpmd: ~2.3
- phpunit/phpunit: ~6.0 || ~7.0
- squizlabs/php_codesniffer: ~2.3
This package is not auto-updated.
Last update: 2025-04-02 05:32:15 UTC
README
Paydemic.com API for PHP
Installation
composer require paydemic/paydemic-php-sdk
API Overview
Every resource is accessed via your paydemic
instance:
$paydemic = new PaydemicPhpSdk('<accessKey>', '<secretAccessKey>') $paydemic->{ RESOURCE_NAME }->{ METHOD_NAME }
Every resource method returns an instance of PromiseInterface (https://promisesaplus.com/), so you don't have to use the regular callback. E.g.
// Create a new purchase link: $finalUrl = "https://paywalledsite.com/paid-access-article"; $title = "My paid access article title"; $currencyCode = "USD"; $price = 4.0; $description = "Extra information"; $paydemic->PurchaseLinks->create( $finalUrl, $title, $currencyCode, $price, $description )->then( // on success function ($purchaseLink) { /* some code */ }, // on exception function ($exception) { /* some error handling code */ }, )
There is also a wait()
method which just waits for the Promise to complete and returns the result:
// Create a new purchase link: $purchaseLink = $paydemic->PurchaseLinks->create( $finalUrl, $title, $currencyCode, $price )->wait();
// Retrieve an existing purchase link: $retrieved = $paydemc->PurchaseLinks->retrieve($purchaseLink['id'])->wait();
// List all the existing purchase links under this project: $listed = $paydemic->PurchaseLinks->listAll()->wait();
// Update an existing purchase link: $finalUrlUpdate = $finalUrl . '#updated'; $titleUpdate = $title . ' UPDATED'; $priceUpdate = 6.0; $descriptionUpdate = $description . ' UPDATED'; $updated = $paydemic->PurchaseLinks->update( $purchaseLink['id'], $finalUrlUpdate, $titleUpdate, $currencyCode, $priceUpdate, $descriptionUpdate )->wait();
// Delete an existing purchase link: $paydemic->PurchaseLinks->delete($purchaseLink['id'])->wait();
Available resources & methods
- PurchaseLinks
Development
Run tests locally
composer install
composer test
Run static analysis tools, run tests with coverage and generate API Doc
composer build
After it finishes, have a look in the build
folder.
Contribution
- If you would like to contribute, please fork the repo and send in a pull request.