Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mooore-digital/ecurring-api-php
eCurring API client library for PHP
https://github.com/mooore-digital/ecurring-api-php
ecurring hacktoberfest library marissen mollie mooore php php-library subscriptions
Last synced: about 1 month ago
JSON representation
eCurring API client library for PHP
- Host: GitHub
- URL: https://github.com/mooore-digital/ecurring-api-php
- Owner: mooore-digital
- License: mit
- Created: 2019-04-05T09:50:01.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-11-01T10:04:02.000Z (about 3 years ago)
- Last Synced: 2024-11-06T13:05:42.214Z (about 2 months ago)
- Topics: ecurring, hacktoberfest, library, marissen, mollie, mooore, php, php-library, subscriptions
- Language: PHP
- Homepage:
- Size: 118 KB
- Stars: 6
- Watchers: 5
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# eCurring API client library for PHP
This is an unofficial library which provides PHP bindings for the eCurring API.
[eCurring Home](https://www.ecurring.com/) | [eCurring API Documentation](https://docs.ecurring.com/)
This library is inspired by [Mollie API client for PHP](https://github.com/mollie/mollie-api-php).
## Requirements
In order to use this library, you need:
- An active eCurring account and API key.
- PHP >= 7.2## Installation
```bash
composer require mooore/ecurring-api-php
```## Getting started
Initializing the eCurring client
```php
use Mooore\eCurring\eCurringHttpClient;$client = new eCurringHttpClient();
$client->setApiKey('your_api_key');
```Creating a customer
```php
$customer = $client->customers->create([
'first_name' => 'John',
'last_name' => 'Doe',
'email' => '[email protected]'
]);
```Creating a subscription from customer
```php
$customer = $client->customers->get(200);
$subscription = $customer->createSubscription(1);
```Creating a subscription from subscription plan
```php
$subscriptionPlan = $client->subscriptionPlans->get(1);
$subscription = $subscriptionPlan->createSubscription(200);
```Get all subscriptions
```php
$customers = $client->customers->page();
do {
foreach ($customers as $customer) {
if ($subscription->isActive()) {
// do something
}
}
} while ($customers = $customers->next());
```## Roadmap
- Implement [Included resources](https://docs.ecurring.com/includes)
- Implement [Sparse Fieldsets](https://docs.ecurring.com/sparse-fieldsets)