bnt-ar / chargify-sdk-php
Chargify SDK for PHP - Use the Chargify API in your PHP project. Fork of chargely/chargify-sdk-php
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 4 203
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 34
Open Issues: 0
Requires
- php: >=5.5.0
- guzzlehttp/guzzle: ^6.0
Requires (Dev)
- fabpot/php-cs-fixer: 1.11
- monolog/monolog: 1.17.2
- phpunit/phpunit: 4.*
This package is not auto-updated.
Last update: 2020-10-09 01:18:59 UTC
README
This library helps you interact with the Chargify API using PHP. It has been used in production for many years by our flagship product, Chargley, a billing portal for Chargify.
- Abstracts away underlying HTTP requests to the Chargify API
- Supports Chargify API v1 and Chargify Direct (v2)
- Well documented
- Unit tested
Installation
Using Composer is the recommended way to install the Chargify SDK for PHP. Composer is a dependency management tool for PHP that allows you to declare the dependencies your project needs and installs them into your project. In order to use the SDK with Composer, you must do the following:
-
Install Composer, if you don't already have it:
curl -sS https://getcomposer.org/installer | php
-
Run the Composer command to install the latest stable version of the SDK:
php composer.phar require chargely/chargify-sdk-php
-
Require Composer's autoloader:
<?php require '/path/to/vendor/autoload.php';
Quick Example
Create a new customer.
<?php require 'vendor/autoload.php'; use Crucial\Service\Chargify; $chargify = new Chargify([ 'hostname' => 'yoursubdomain.chargify.com', 'api_key' => '{{API_KEY}}', 'shared_key' => '{{SHARED_KEY}}' ]); // Crucial\Service\Chargify\Customer $customer = $chargify->customer() // set customer properties ->setFirstName('Dan') ->setLastName('Bowen') ->setEmail('dan@mailinator.com') // send the create request ->create(); // check for errors if ($customer->isError()) { // array of errors loaded during the transfer $errors = $customer->getErrors(); } else { // the transfer was successful $customerId = $customer['id']; // Chargify customer ID $firstName = $customer['first_name']; $lastName = $customer['last_name']; $email = $customer['email']; }
Help and Documentation
Contributing
Please see CONTRIBUTING.md for more information.