lob / lob-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.
Installs: 2 953 723
Dependents: 6
Suggesters: 0
Security: 0
Stars: 67
Watchers: 63
Forks: 21
Open Issues: 12
Requires
- php: ^7.3 || ^8.1
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^2.0
- jean85/pretty-package-versions: ^1.5 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.12
- phpunit/phpunit: ^8.0 || ^9.0
- dev-main
- 4.2.7
- 4.2.6
- 4.2.3
- 4.2.0
- 4.1.0
- 4.0.0
- 4.0.0-rc-3
- v3.5.6
- v3.5.5
- v3.5.4
- v3.5.3
- v3.5.2
- v3.5.1
- v3.5.0
- v3.4.0
- v3.3.0
- v3.2.0
- v3.1.0
- v3.0.6
- v3.0.5
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.3.0
- v2.2.0
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.0
- v1.7.1
- v1.7.0
- v1.6.4
- v1.6.3
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.0
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.0
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.5
- v1.1.4
- v1.1.3
- V1.1.2
- V1.1.1
- V1.1.0
- v1.0.1
- v1.0.0
- dev-feature/AV-4535-transient-id-update-version
- dev-feature/AV-4535-transient-id
- dev-GC-1944/update-lob-address
- dev-fix/update-composer-version-4.2.6
- dev-fix/update-composer-version
- dev-AV-4395-us-verifications-update
- dev-GC-1583-2
- dev-GC-1583
- dev-dependabot/composer/guzzlehttp/psr7-2.4.5
- dev-uploads
- dev-v3-legacy
This package is auto-updated.
Last update: 2024-10-30 21:57:04 UTC
README
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
About this package
This PHP package is automatically generated by the OpenAPI Generator project:
- API version:
1.3.0
- Package version:
1.0.0
- Package version:
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen