PHPackages                             spira/zuora-laravel-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. spira/zuora-laravel-sdk

ActiveProject[API Development](/categories/api)

spira/zuora-laravel-sdk
=======================

Lumen/Laravel service provider for interfacing with Zuora SOAP API

0.16(9y ago)05392MITPHP

Since Jan 27Pushed 9y ago6 watchersCompare

[ Source](https://github.com/spira/zuora-laravel-sdk)[ Packagist](https://packagist.org/packages/spira/zuora-laravel-sdk)[ RSS](/packages/spira-zuora-laravel-sdk/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (7)Dependencies (8)Versions (23)Used By (0)

zuora-laravel-sdk
=================

[](#zuora-laravel-sdk)

Lumen/Laravel service provider for interacting with [Zuora SOAP API](https://knowledgecenter.zuora.com/BC_Developers/SOAP_API)

[![Build Status](https://camo.githubusercontent.com/9e91813df8b074fa680bc976b17820998d0b5b59d001c8f012c2d08f77d563be/68747470733a2f2f7472617669732d63692e6f72672f73706972612f7a756f72612d6c61726176656c2d73646b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/spira/zuora-laravel-sdk)[![Coverage Status](https://camo.githubusercontent.com/ce85f28ac51c1a65d99ff6eb88843e4bc6b24e51e293252bf8b1edf628e590bd/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f73706972612f7a756f72612d6c61726176656c2d73646b2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/spira/zuora-laravel-sdk?branch=master)[![StyleCI](https://camo.githubusercontent.com/5b8a4670497fd47c769020c4d1fc68b14be05982d1a01bcc810509fd3df549ce/68747470733a2f2f7374796c6563692e696f2f7265706f732f35303134333938332f736869656c64)](https://styleci.io/repos/50143983)

Install and configuration
=========================

[](#install-and-configuration)

You can install this package via [Composer](http://getcomposer.org).

Direct usage (framework agnostic)
---------------------------------

[](#direct-usage-framework-agnostic)

For using Zuora API you should register an account and get credentials for accessing an API. All credentials are passed into `API::__construct` method in array with structure:

```
[
    'wsdl'     => '/path/to/zuora.wsdl',
    'username' => 'user@example.com',
    'password' => 'very-good-password',
    'endpoint' => 'https://apisandbox.zuora.com/apps/services/a/74.0',
]
```

You can find sample config file in `storage/config.dist.php`

Lumen\\Laravel Service Provider
-------------------------------

[](#lumenlaravel-service-provider)

1. Register `ZuoraSdkServiceProvider` in your app
2. Create a config file named `zuora.php` in config folder and put there contents of `storage/config.dist.php`
3. Have fun

Tests
=====

[](#tests)

This library is tested using PHPUnit and [Mockery](http://docs.mockery.io/en/latest/index.html).

If you want to run full set of integration tests you should fill your `storage/config.php` file, which is excluded from source tree and copied automatically from `config.dist.php` with Composer's `post-install-cmd`. Otherwise all tests making real api calls will be skipped. *Make sure you provided sandbox credentials!*

Class Reference
===============

[](#class-reference)

All classes are located under `Spira\ZuoraSdk` namespace is omitted below.

API
---

[](#api)

This class:

- Configures and stores `\SoapClient`, you can use `getClient()` and `setClient(\SoapClient $client)` methods for access
- Performs lazy authorization on first request
- Provides methods for operating with `DataObject` entites
- Provides methods for selecting `DataObject` with ZOQL
- Converts Zuora API Errors to thrown `\Spira\ZuoraSdk\Exception\ApiException`

Current list of implemented methods:

- `create($objects)` - Create object in API. Accepts `DataObject|DataObject[]`
- `update($objects)` - Update object in API. Accepts `DataObject|DataObject[]`
- `delete($type, $ids)` - Delete objects of `$type` with IDs `int|array $ids`
- `query($query, $limit = null)` - Runs a query and returns objects of type was queried.
- `queryMore($limit)` - If resultset for `query()` has few pages use this method to get next pages of previous call.
- `hasMore()` - Check does last `query()` has next page of resultset.

DataObject
----------

[](#dataobject)

`DataObject` is an object for storing data while operating with API.

It extends `\Illuminate\Support\Fluent` so all data manipulation is done easilly in array- or object-like syntax.

QueryBuilder
------------

[](#querybuilder)

Zuora API provides [ZOQL](https://knowledgecenter.zuora.com/BC_Developers/SOAP_API/M_Zuora_Object_Query_Language) - simplified query language for querying objects from api.

QueryBuilder allows building such queries in fluent style:

```
$builder = new QueryBuilder('Products', ['Id', 'Name']);
$builder->where('Age', '=', $age)
    ->orWhere('Id', '=', $id);
echo $builder->toZoql(); // Output: SELECT Id, Name FROM Products WHERE Age = 18 OR Id = 1
```

Mostly it used for making queries in `Zuora` class described below.

Zuora
-----

[](#zuora)

This class provides querying helpers and some part of common logic for using API.

- `getAll($table, array $columns, $limit = null, \Closure $filtered = null)` - builds a query and returns an array of objects of type `$table`
- `getOne($table, array $columns, \Closure $filtered = null)` - builds a query and returns one object of type `$table`
- `getOneById($table, $columns, $id)` - pretty the same as `getOne` but with built-in filter by id.

Instance of `QueryBuilder` is passed into `$filtered` lambda for adding conditions to query if needed. While ZOQL does not support wildcards for columns you should provide list of them manually.

For some types of objects there are added custom methods:

**Products**

- `getAllProducts(array $columns = null, $limit = null, \Closure $filtered = null)`
- `getOneProduct($id, array $columns = null)`
- `getAllProductRatePlans(array $columns = null, $limit = null, \Closure $filtered = null)`
- `getRatePlansForProduct($product, array $columns = null, $limit = null)`
- `getOneProductRatePlan($id, array $columns = null)`
- `getOneProductRatePlanActiveCurrencies($ratePlan)`
- `getAllProductRatePlanCharges(array $columns = null, $limit = null, \Closure $filtered = null)`
- `getChargesForProductRatePlan($ratePlan, array $columns = null, $limit = null)`
- `getOneProductRatePlanCharge($id, array $columns = null)`
- `getAllProductRatePlanChargeTiers(array $columns = null, $limit = null, \Closure $filtered = null)`
- `getTiersForProductRatePlanCharge($ratePlanCharge, array $columns = null, $limit = null)`
- `getOneProductRatePlanChargeTier($id, array $columns = null)`

**Accounts**

- `getAllAccounts(array $columns = null, $limit = null, \Closure $filtered = null)`
- `getOneAccount($id, array $columns = null)`
- `getContactsForAccount($account, array $columns = null, $limit = null)`
- `getOneContact($id, array $columns = null)`
- `getPaymentMethodsForAccount($account, array $columns = null, $limit = null)`
- `getOnePaymentMethod($id, array $columns = null)`
- `getAllPaymentMethods(array $columns = null, $limit = null, \Closure $filtered = null)`
- `createAccount(Account $account, Contact $contact, PaymentMethod $paymentMethod = null)`

**Subscriptions**

- `getAllSubscriptions(array $columns = null, $limit = null, \Closure $filtered = null)`
- `getOneSubscription($id, array $columns = null)`
- `getSubscriptionsForAccount($account, array $columns = null, $limit = null)`
- `subscribe(Account $account, Subscription $subscription, ProductRatePlan $ratePlan, ProductRatePlanCharge $ratePlanCharge = null, PaymentMethod $paymentMethod = null, Contact $contact = null, SubscribeOptions $subscribeOptions = null)`

**Payments &amp; Invoices**

- `getAllPayments(array $columns = null, $limit = null, \Closure $filtered = null)`
- `getOnePayment($id, array $columns = null)`
- `getPaymentsForAccount($account, array $columns = null, $limit = null)`
- `getAllInvoices(array $columns = null, $limit = null, \Closure $filtered = null)`
- `getOneInvoice($id, array $columns = null)`
- `getInvoicesForAccount($account, array $columns = null, $limit = null)`

Usage Example
=============

[](#usage-example)

```
use Monolog\Logger;
use Spira\ZuoraSdk\API;
use Spira\ZuoraSdk\Zuora;
use Monolog\Handler\StreamHandler;
use Spira\ZuoraSdk\DataObjects\Product;

$config = require '/path/to/config.php';
$logger = new Logger('zuora', [new StreamHandler('path/to/zuora.log')]); // optional logger usage
$api    = new API($config, $logger);
$zuora  = new Zuora($api);

// Create a new product

$product = new Product(['Name' => 'My Product']);
$api->create($product);

// Get list of a products

/** @var $products Product[] */
$products = $zuora->getAllProducts();

// Delete product

$api->delete('Product', [$product->Id]);
```

You can find more samples in tests.

Contribution
============

[](#contribution)

All commits MUST follow [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) coding style guide.

You may use the [PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) manually or use git `pre-commit` hook supplied in `hooks/pre-commit`. Follow instructions in file and make sure it is executable.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 63.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~24 days

Total

17

Last Release

3409d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6733635?v=4)[iquitsugar](/maintainers/iquitsugar)[@iquitsugar](https://github.com/iquitsugar)

---

Top Contributors

[![cmsx](https://avatars.githubusercontent.com/u/2027189?v=4)](https://github.com/cmsx "cmsx (28 commits)")[![zakhenry](https://avatars.githubusercontent.com/u/721513?v=4)](https://github.com/zakhenry "zakhenry (7 commits)")[![Redjik](https://avatars.githubusercontent.com/u/1131017?v=4)](https://github.com/Redjik "Redjik (6 commits)")[![rayzor65](https://avatars.githubusercontent.com/u/4978547?v=4)](https://github.com/rayzor65 "rayzor65 (2 commits)")[![alackmann](https://avatars.githubusercontent.com/u/2003765?v=4)](https://github.com/alackmann "alackmann (1 commits)")

---

Tags

laravelsdklumensoapzuora

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/spira-zuora-laravel-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/spira-zuora-laravel-sdk/health.svg)](https://phpackages.com/packages/spira-zuora-laravel-sdk)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[resend/resend-laravel

Resend for Laravel

1212.2M8](/packages/resend-resend-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
