phppro/sdk

This package is abandoned and no longer maintained. No replacement package was suggested.

PHPPRO SDK

1.5.3 2016-01-13 10:36 UTC

README

This repository contains the PHP SDK and Symfony 2 SDK Bundle that allows you to access any API that conforms to PHPPRO's API rules.

Usage

Symfony 2 integration (SDK Bundle)

This version of the bundle requires Symfony 2.5+.

Installation

Installation is a quick 4 step process:

  1. Download phppro/sdk using composer
  2. Enable the Bundle
  3. Configure your application's security.yml
  4. Configure the SdkBundle

Step 1: Download phppro/sdk using composer

Add phppro/sdk dependency to your composer.json :

# composer.json
{
    "require": {
        "phppro/sdk": "1.*"
    },

    ...
}

Then update:

$ php composer.phar update phppro/sdk

Composer will install the bundle to your project's vendor/phppro/sdk directory and additional required packages.

Step 2: Enable the bundle

Enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Phppro\Sdk\SdkBundle(),
    );
}

Step 3: Configure your application's security.yml

# app/config/security.yml
security:
    encoders:
        phppro\Common\SdkBundle\Security\User\ApiUser:
          id: sdk.api.password_encoder

    role_hierarchy:
        ...

    providers:
        api:
          id: sdk.api.user_provider

    firewalls:
        ...

Step 4: Configure the phpproCommonSdkBundle

# app/config/config.yml
phppro_common_sdk:
  host:     "%api.host%"
  login:    "%api.login%"
  password: "%api.password%"
  clientId: "%api.clientId%"

You can then add all the %api.*% parameters into your app/config/parameters.yml(.dist) :

# app/config/parameters.yml
    # contact phppro dev team to obtain the appropriate host name
    api.host: api.phppro.com
    # contact phppro dev team to obtain the appropriate login name
    api.login: mylogin
    # contact phppro dev team to obtain the appropriate password hash
    api.password: abcd1234...
    # contact phppro dev team to obtain the appropriate client id
    api.clientId: myclient

More bundle configuration parameters are available but optional (redis cache for token, ...)

Next Steps

Contact the phppro dev team for further information.