Litwicki ChargifyBundle
A bundle intending to seamlessly integrate to Chargify via their Api., (*1)
, (*2)
, (*3)
Setup
Installation and configuration requires three simple steps., (*4)
1. Download the bundle
****IMPORTANT**** While in early development, you will need to set your minimum-stability
to dev-master
to use this bundle., (*5)
$ composer require "litwicki/chargify-bundle"
2. Enable the bundle
// app/AppKernel.php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Litwicki\Bundle\ChargifyBundle\LitwickiChargifyBundle(),
);
// ...
}
}
# app/config/config.yml
litwicki_chargify:
test_mode: false
data_format: json
route_prefix: /chargify
domain: ~
api_key: ~
shared_key: ~
Optionally, you can include integration for Chargify Direct (API V2), (*6)
# app/config/config.yml
litwicki_chargify:
# ...
direct:
api_id: ~
api_secret: ~
api_password: ~
4. Serialization
Serialization is required to process Objects with the API so you will need to make sure you have enabled the serializer., (*7)
If not, you can do that by following these instructions, (*8)
# app/config/config.yml
framework:
# ...
serializer:
enabled: true
# app/config/services.yml
services:
# ...
get_set_method_normalizer:
class: Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer
tags:
- { name: serializer.normalizer }
Usage
This Bundle functions as a middle-tier layer between your Symfony app and Chargify. The handler for each entity leverages the available RESTful operations available., (*9)
Please make sure to reference the Chargify Api Docs for available parameters for each object., (*10)
GET
- Find an object.
//example load a Subscription by Id.
$id = 12345;
$handler = $this->get('chargify.handler.subscription');
$subscription = $handler->get($id);
POST
- Create a new object.
//let's create an example customer
$data = array(
'first_name' => 'John',
'last_name' => 'Doe',
'email' => 'john.doe@example.com'
);
$handler = $this->get('chargify.handler.customer');
$customer = $handler->post($data);
PUT
- Updating an existing object.
Let's update the customer record we just created (example above)., (*11)
//...
$customer->setFirstName('Jonathan');
$customer = $handler->put($customer);
DELETE
- Remove an object.
We changed our mind, let's remove this customer., (*12)
$response = $handler->delete($customer);
Contributing
Thank you for considering contributing to this bundle! This bundle is in early development and is actively seeking maintainers., (*13)
I am particularly interested in help with the following:, (*14)
- Testing all the things
- Identityfing and patching any security issues
- Ongoing support and improvements
Work-In-Progress Items:
- Develop v2 API layer (handlers) for handling calls, signups, and card updates
- Force all submissions to pass through Form validation
- Setup serialization groups so read_only fields aren't submitted via POST or PUT when serializing a full entity.
License
This bundle is open-sourced software licensed under the MIT license., (*15)