PHPackages                             ordersaga/php-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. ordersaga/php-sdk

ActiveLibrary[API Development](/categories/api)

ordersaga/php-sdk
=================

1.0.0(4y ago)026PHP

Since Mar 13Pushed 4y ago1 watchersCompare

[ Source](https://github.com/OrderSaga/PHP-SDK)[ Packagist](https://packagist.org/packages/ordersaga/php-sdk)[ RSS](/packages/ordersaga-php-sdk/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

OrderSaga PHP SDK
=================

[](#ordersaga-php-sdk)

This SDK allows you to quickly get up and running with your OrderSaga integration.

Dependencies
------------

[](#dependencies)

GuzzleHTTP, PHP 7.1+

Prerequisites
-------------

[](#prerequisites)

An ordersaga.com account and API Key

Installation
------------

[](#installation)

```
composer require ordersaga/php-sdk

```

Create an environment variable for the API key and API version

```
ORDERSAGA_API_KEY="enter_it_here"
ORDERSAGA_API_VERSION=1

```

If you have multiple keys, you can switch between them either by providing them during instantiation of the Endpoint class, or by setting it globally:

```
$sdk = new UserEndpoint(); //uses default API key from the environment variables above
$sdk2 = new FormEndpoint(getenv('MY_SECOND_API_KEY'));
$sdk3 = new OrderEndpoint(getenv('MY_SECOND_API_KEY'));
//or
$sdk = new UserEndpoint();
Client::setAPIKeyGlobally(getenv('MY_SECOND_API_KEY'));
$sdk2 = new FormEndpoint(); //or FormEndpoint::create()
$sdk3 = new OrderEndpoint(); //or OrderEndpoint::create()

```

The same thing works for the API version

```
$sdk = new UserEndpoint(null, 2);
$sdk = new FormEndpoint(null, 2);
//or
Client::setAPIVersionGlobally(2);
$sdk = new UserEndpoint(); //or UserEndpoint::create()
$sdk = new FormEndpoint(); //or FormEndpoint::create()

```

You can also set both the key and the version at the same time globally

```
Client::setAPIKeyGlobally(getenv('MY_SECOND_API_KEY'), 2);

```

Development/Sandbox
-------------------

[](#developmentsandbox)

Just prepend your API key with "dev\_" in order to enable sandbox mode.

Example:

```
ORDERSAGA_API_KEY="dev_[api_key_here]"

```

Client User
-----------

[](#client-user)

Each action taken stores a historical record of what was done. To accurately tie this change to the user making it, a client\_user\_id is automatically added to each request. This value is pulled from $\_ENV\['CLIENT\_USER\_ID'\]. On each request, you should set this value to the current Guest or User's ID.

Usage
-----

[](#usage)

A sample of the addUser method:

```
//instantiate the User and Company objects from the SharedObjects folder
$user = new User(); //or User::create()
$company = new Company(); //or Company::create()

//set values (generally from a user submitted form)
//it's a very good idea to perform your own validation on this data prior to setting it
$user->setFname($_POST['fname']);
$user->setLname($_POST['lname']);
$user->setEmail($_POST['email']);

$company->setName($_POST['company']);

$user->setCompany($company);

//instantiate the user endpoint
$user_sdk = new UserEndpoint(); //or UserEndpoint::create()

//an exception will be thrown if anything other than a 200 is returned
//an updated User object is returned on success
$new_user = $user_sdk->addUser($user);
```

Users
-----

[](#users)

Users come in 3 flavors:

1. Guest: They do not officially have an account in the system, but they are treated the same. They are identified by a token to group their submissions and actions. Upon login, the guest account will be merged with the user.
2. User: They are a full-fledged user with password.
3. Employee: Essentially the same as a User, but with the ability to differentiate, you can display things like the cost of products or administration features.

Any endpoint method that accepts/requires a $user\_id accepts the ID of any of these users. $guest-&gt;getId() for instance.

You can create a Guest using information they provided on your Contact Us form (or any other form), or as a totally blank anonymous Guest (like if someone adds a product to their cart)

```
$guest = new Guest();
$guest->setFname('Bob');
$guest->setLname('Jenkins');
$guest->setEmail('bob@jenkins.com');

$guest = (new GuestEndpoint())->addGuest($guest);

//or

$guest = (new GuestEndpoint())->addGuest();
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

1572d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3077dc055490bd952e5a0870cee45db97e52193ca7a3216d6fb18019df2c7ee4?d=identicon)[HTMLGuyLLC](/maintainers/HTMLGuyLLC)

---

Top Contributors

[![HTMLGuyLLC](https://avatars.githubusercontent.com/u/2415447?v=4)](https://github.com/HTMLGuyLLC "HTMLGuyLLC (1 commits)")

### Embed Badge

![Health badge](/badges/ordersaga-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/ordersaga-php-sdk/health.svg)](https://phpackages.com/packages/ordersaga-php-sdk)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M985](/packages/statamic-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M47](/packages/tencentcloud-tencentcloud-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.5M7](/packages/avalara-avataxclient)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)

PHPackages © 2026

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