litwicki / chargify-bundle
Chargify billing service integration
Installs: 52
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 4
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7
- guzzlehttp/guzzle: ^6.0
- incenteev/composer-parameter-handler: ^2.0
- jms/serializer: ^1.0.0
- jms/serializer-bundle: ^1.1
- litwicki/common: dev-master
- symfony/symfony: 3.*
- twig/twig: ^2.0
Requires (Dev)
- phpunit/phpunit: 5.0.*
- symfony/phpunit-bridge: ^2.7
This package is not auto-updated.
Last update: 2024-06-16 02:28:04 UTC
README
Litwicki ChargifyBundle
A bundle intending to seamlessly integrate to Chargify via their Api.
Setup
Installation and configuration requires three simple steps.
1. Download the bundle
IMPORTANT While in early development, you will need to set your minimum-stability
to dev-master
to use this bundle.
$ 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(),
);
// ...
}
}
3. Configure the bundle
# 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)
# 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.
If not, you can do that by following these instructions
# 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.
Please make sure to reference the Chargify Api Docs for available parameters for each object.
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).
//...
$customer->setFirstName('Jonathan');
$customer = $handler->put($customer);
DELETE
- Remove an object.
We changed our mind, let's remove this customer.
$response = $handler->delete($customer);
Contributing
Thank you for considering contributing to this bundle! This bundle is in early development and is actively seeking maintainers.
I am particularly interested in help with the following:
- 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.