Code Monkey home page Code Monkey logo

lob-php's Introduction

OpenAPIClient-php

The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

For more information, please visit our API documentation. Looking for our legacy PHP SDK?

Requirements

PHP 7.3 and later. Should also work with PHP 8.0 but has not been tested.

Getting Started

Registration

First, you will need to first create an account at Lob.com and obtain your Test and Live API Keys.

Once you have created an account, you can access your API Keys from the Settings Panel.

Installation & Usage

Composer

To install the bindings via Composer, run php composer.phar install

Manual Installation

Download the files and include autoload.php:

<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

First API Call

<?php
require_once(__DIR__ . '/vendor/autoload.php');



// Configure HTTP basic authorization: basicAuth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new OpenAPI\Client\Api\AddressesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$address_editable = new \OpenAPI\Client\Model\AddressEditable(); // \OpenAPI\Client\Model\AddressEditable

try {
    $result = $apiInstance->addressCreate($address_editable);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AddressesApi->addressCreate: ', $e->getMessage(), PHP_EOL;
}

API Documentation

The full and comprehensive documentation of Lob's APIs is available here.

Authorization

basicAuth

  • Type: HTTP basic authentication

Testing

Before running tests,

$ composer install

Unit Tests

$ vendor/bin/phpunit --group unit --coverage-text --coverage-html coverage/html

Integration Tests

Integration tests run against a live deployment of the Lob API and require multiple valid API keys with access to specific features. As such, it is not expected that these tests will pass for every user in every environment.

To run integration tests:

$ LOB_API_TEST_KEY=<<YOUR TEST KEY>> LOB_API_LIVE_KEY=<<YOUR LIVE KEY>> vendor/bin/phpunit --group integration --coverage-text --coverage-html coverage/html

A cleaner alternative if you are going to run integration tests frequently

Run this the first time:

$ echo "LOB_API_TEST_KEY=<<YOUR TEST KEY>> LOB_API_LIVE_KEY=<<YOUR LIVE KEY>>" > LOCAL.env

Then, to run the integration tests:

$ env $(cat LOCAL.env) vendor/bin/phpunit --group integration --coverage-text --coverage-html coverage/html

Author

[email protected]

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 1.3.0
    • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

lob-php's People

Contributors

pon avatar sudoku-lord avatar daniloassis avatar joshstrange avatar bennykitchell avatar mwj8410 avatar leore avatar mpiercy827 avatar jho44 avatar ami avatar shrav avatar robinjoseph08 avatar dmlittle avatar amrit avatar elnaz avatar graysonchao avatar russelltaylor05 avatar amaan-lob avatar sishaarrao avatar dependabot[bot] avatar siddharthpant92 avatar charlesbjohnson avatar forbaokhanh avatar mrkaspa avatar brianseitel avatar aarondfrancis avatar ph-7 avatar mriosdandb avatar haroutrs avatar ajpawlicki 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.