Git Product home page Git Product logo

cometcultbraintreebundle's Introduction

CometCultBraintreeBundle

Build Status

Symfony 2 Bundle for Braintree's PHP client library

Installation

Just add to your composer.json file:

{
    require: {
        "cometcult/braintree-bundle": "dev-master"
    }
}

Configuration

# app/config/config.yml
# ...
comet_cult_braintree:
  environment: sandbox
  merchant_id: your_merchant_id
  public_key: your_public_key
  private_key: your_private_key

For more info about the configuration variables see Braintree docs

Usage

Braintree php client library comes with a bunch of services for the Braintree API. They are usually prefixed by Braintree_. To see all available Braintree services head over to braintree_php or the official documentation.

Factory

One of the methods for getting a desired service is to call the get method from the BraintreeFactory:

// in your controller
$factory = $this->get('comet_cult_braintree.factory');
$customerService = $factory->get('customer');

Defining a service

Instead of calling the factory you can define a custom service in your own bundle:

# ../services.yml
services:
    customer_custom_service:
        class:            Braintree_Customer
        factory_service:  comet_cult_braintree.factory
        factory_method:   get
        arguments: ["customer"]

Then in your controller you can go with:

$customerService = $this->get('customer_custom_service');

cometcultbraintreebundle's People

Watchers

Karol Sójko avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.