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

ActiveLibrary[API Development](/categories/api)

joonweb/joonweb-sdk
===================

Professional PHP SDK for building applications on the JoonWeb platform

v1.0.2(6mo ago)05MITPHPPHP ^8.0

Since Oct 28Pushed 5mo agoCompare

[ Source](https://github.com/JoonWebdotcom/joonweb-php-sdk)[ Packagist](https://packagist.org/packages/joonweb/joonweb-sdk)[ RSS](/packages/joonweb-joonweb-sdk/feed)WikiDiscussions main Synced 1mo ago

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

JoonWeb PHP SDK
===============

[](#joonweb-php-sdk)

Professional PHP SDK for building applications on the JoonWeb platform.

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

[](#installation)

```
composer require joonweb/joonweb-sdk

```

### Requirements

[](#requirements)

- PHP 8.0+
- cURL extension
- JSON extension

Quick bootstrap (framework-agnostic example)
--------------------------------------------

[](#quick-bootstrap-framework-agnostic-example)

Add a tiny bootstrap before using the SDK in your app. This example shows how to initialize the context and use the repository-provided `SessionManager` (replace with your own persistent storage in production):

```
require 'vendor/autoload.php';
use JoonWeb\Context;
use JoonWeb\Auth\SessionManager; // repo-provided session manager

Context::init([
    'api_key' => getenv('JOONWEB_CLIENT_ID'),
    'api_secret' => getenv('JOONWEB_CLIENT_SECRET'),
    'api_version' => getenv('JOONWEB_API_VERSION') ?: '26.0',
    'is_embedded' => false,
    // Optional: provide your own session storage implementation. By default the repo's SessionManager will be used if present.
    // 'session_storage' => new SessionManager(),
]);

$api = new JoonWeb\JoonWebAPI();
$api->setAccessToken(/* access token from your session or OAuth flow */)
        ->setSiteDomain('example.myjoonweb.com');

```

Notes:

- Replace `SessionManager` with a persistent implementation for multi-process servers (DB, Redis, etc.).
- The SDK is REST-first; use the REST resource clients (e.g. `$api->product`) to call endpoints.

Quick Start
-----------

[](#quick-start)

### 1. Authentication Setup

[](#1-authentication-setup)

```
use JoonWeb\JoonWebAPI;

$auth_url = "https://accounts.joonweb.com/oauth/authorize?" . http_build_query([
    'client_id' => JOONWEB_CLIENT_ID,
    'scope' => 'read_products,write_products',
    'redirect_uri' => JOONWEB_REDIRECT_URI,
    'site' => $site_domain
]);

header("Location: " . $auth_url);

```

### 2. Handle OAuth Callback

[](#2-handle-oauth-callback)

```
use JoonWeb\JoonWebAPI;

$joonweb = new JoonWebAPI();
$token_data = $joonweb->exchangeCodeForToken($_GET['code'], $_GET['site']);

$joonweb->setAccessToken($token_data['access_token'])
        ->setSiteDomain($_GET['site']);

$session->startSession($_GET['site'], $token_data);
header("Location: /embedded.php");

```

### 3. Use in Your App

[](#3-use-in-your-app)

```
$api = new JoonWebAPI($access_token, $site_domain);

// Or configure later
$api = new JoonWebAPI();
$api->setAccessToken($token)
    ->setSiteDomain($site_domain);

```

API Resources
-------------

[](#api-resources)

### Products

[](#products)

```
// Get all products
$products = $api->product->all(['limit' => 10]);

// Get single product
$product = $api->product->get(123);

// Create product
$new_product = $api->product->create([
    'title' => 'New Product',
    'price' => 29.99
]);

// Update product
$updated = $api->product->update(123, [
    'title' => 'Updated Product'
]);

// Count products
$count = $api->product->count();

### Orders
// Get all orders
$orders = $api->order->all(['status' => 'open', 'limit' => 50]);

// Get single order
$order = $api->order->get(456);

// Count orders
$order_count = $api->order->count(['status' => 'open']);

```

### Customers

[](#customers)

```
// Get all customers
$customers = $api->customer->all(['limit' => 50]);

// Get single customer
$customer = $api->customer->get(789);

### Webhooks
// Get all webhooks
$webhooks = $api->webhook->all();

// Create webhook
$webhook = $api->webhook->create([
    'topic' => 'orders/create',
    'address' => 'https://yourapp.com/webhooks/orders',
    'format' => 'json'
]);

// Delete webhook
$api->webhook->delete(111);

```

### Site Information

[](#site-information)

```
// Get site details
$site = $api->site->get();

```

Configuration
-------------

[](#configuration)

### Environment Variables

[](#environment-variables)

Set these in your .env file:

```
APP_NAME="Your App Name"
JOONWEB_CLIENT_ID=your_client_id
JOONWEB_CLIENT_SECRET=your_client_secret
JOONWEB_REDIRECT_URI=https://yourapp.com/auth/callback.php
JOONWEB_API_VERSION=26.0

```

Error Handling
--------------

[](#error-handling)

All methods throw Exception on failure:

```
try {
    $products = $api->product->all();
} catch (Exception $e) {
    error_log("API Error: " . $e->getMessage());
    // Handle error
}

```

Webhook Verification
--------------------

[](#webhook-verification)

Verify incoming webhooks with HMAC:

```
$hmac_header = $_SERVER['HTTP_X_JOONWEB_HMAC_SHA256'];
$payload = file_get_contents('php://input');
$calculated_hmac = base64_encode(hash_hmac('sha256', $payload, JOONWEB_CLIENT_SECRET, true));

if (hash_equals($hmac_header, $calculated_hmac)) {
    // Webhook is valid
    $data = json_decode($payload, true);
}

```

Support
-------

[](#support)

- Documentation: JoonWeb Developer Portal
- Issues: GitHub Issues
- Community: JoonWeb Developer Forum

License
-------

[](#license)

MIT License

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance69

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

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

Every ~10 days

Total

3

Last Release

180d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0ec12b878fdce69e4b0a0ff7436720022e9d4fa70e2f3aeb99816ce05652466a?d=identicon)[abbascoder](/maintainers/abbascoder)

---

Top Contributors

[![abbascoder1](https://avatars.githubusercontent.com/u/54513187?v=4)](https://github.com/abbascoder1 "abbascoder1 (15 commits)")

---

Tags

joonwebjoonweb-apijoonweb-appsjoonweb-sdksdksdk-phpapisdkplatformecommercejoonweb

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[ringcentral/ringcentral-php

RingCentral Platform PHP SDK

541.2M5](/packages/ringcentral-ringcentral-php)

PHPackages © 2026

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