2017 © Pedro Peláez
 

library cub

A PHP Client for Cub

image

cub/cub

A PHP Client for Cub

  • Wednesday, October 25, 2017
  • by jonnypickett
  • Repository
  • 21 Watchers
  • 1 Stars
  • 386 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Build Status, (*1)

Cub Client for PHP

Requirements

PHP versions 5.3, 5.4, 5.5, 5.6, 7.0, 7.1 compiled with cURL., (*2)

Installation

Install with Composer

If you're using Composer <http://getcomposer.org>_ to manage dependencies, you can add Cub Client for PHP with it:, (*3)

{
    "require": {
        "cub/cub": ">=0.1.0"
    }
}

or to get the latest version off the master branch:, (*4)

{
    "require": {
        "cub/cub": "dev-master"
    }
}

Install source from GitHub

Install the source code:, (*5)

$ git clone git://github.com/praetoriandigital/cub-php.git

And include it using the autoloader:, (*6)

require_once '/your/libraries/path/Cub/Autoloader.php';
Cub_Autoloader::register();

Or, if you're using Composer:, (*7)

require_once 'vendor/autoload.php';

Usage

Sign user in

Cub_Config::$api_key = '<your-secret-key>';

$user = Cub_User::login($username = '<username>', $password = '<password>');
// Now you can use user object
$first_name = $user->first_name;
$last_name = $user->last_name;
// And so on

Handle webhook from Cub

Cub_Config::$api_key = '<your-secret-key>';

$user = Cub_Object::fromJson($HTTP_RAW_POST_DATA);

// In this example we handle user creation/modification:
if ($object instanceof Cub_User) {

    if ($user->deleted) {
        // object was deleted, do something with it
    } else {
        // Reload user with membership and organization info
        $user.reload(array('expand' => 'membership__organization'));

        // Now $user contains the most recent information, including membership and organization info
        $organization_name = $user->membership[0]->organization->name;
        // Do something with it
    }
}

Check more examples in tests., (*8)

The Versions

25/10 2017

dev-master

9999999-dev https://github.com/ivelum/cub-php

A PHP Client for Cub

  Sources   Download

MIT

The Requires

  • php >=5.3
  • ext-curl *

 

The Development Requires

api cub

25/10 2017

0.1.6

0.1.6.0 https://github.com/ivelum/cub-php

A PHP Client for Cub

  Sources   Download

MIT

The Requires

  • php >=5.3
  • ext-curl *

 

The Development Requires

api cub

25/10 2017

0.1.5

0.1.5.0 https://github.com/ivelum/cub-php

A PHP Client for Cub

  Sources   Download

MIT

The Requires

  • php >=5.3
  • ext-curl *

 

The Development Requires

api cub

24/10 2017

0.1.4

0.1.4.0 https://github.com/ivelum/cub-php

A PHP Client for Cub

  Sources   Download

MIT

The Requires

  • php >=5.3
  • ext-curl *

 

The Development Requires

api cub

23/10 2017

0.1.3

0.1.3.0 https://github.com/ivelum/cub-php

A PHP Client for Cub

  Sources   Download

MIT

The Requires

  • php >=5.3
  • ext-curl *

 

The Development Requires

api cub

21/09 2017

0.1.2

0.1.2.0 https://github.com/ivelum/cub-php

A PHP Client for Cub

  Sources   Download

MIT

The Requires

  • php >=5.3
  • ext-curl *

 

The Development Requires

api cub

19/09 2017

0.1.1

0.1.1.0 https://github.com/ivelum/cub-php

A PHP Client for Cub

  Sources   Download

MIT

The Requires

  • php >=5.3
  • ext-curl *

 

The Development Requires

api cub

19/09 2017

0.1.0

0.1.0.0 https://github.com/ivelum/cub-php

A PHP Client for Cub

  Sources   Download

MIT

The Requires

  • php >=5.3
  • ext-curl *

 

The Development Requires

api cup