PHPackages                             luizsilva-dev/cj-sdk-php - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. luizsilva-dev/cj-sdk-php

ActiveLibrary[HTTP &amp; Networking](/categories/http)

luizsilva-dev/cj-sdk-php
========================

Complete PHP SDK for CJ Affiliate API - Product Search, Advertiser Lookup, Commission Tracking, Link Search and more

1.0.0(6mo ago)0196MITPHPPHP &gt;=7.4

Since Nov 15Pushed 6mo agoCompare

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

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

CJ Affiliate SDK for PHP
========================

[](#cj-affiliate-sdk-for-php)

[![Latest Stable Version](https://camo.githubusercontent.com/b1c1278aca58a889ed2eafa72d601de824ebb92f0135749ec3e7092de2f5bfa9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c75697a73696c76612d6465762f636a2d73646b2d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/luizsilva-dev/cj-sdk-php)[![Total Downloads](https://camo.githubusercontent.com/ea9314e9c0c464d2f1ae3dcd25284a962803a388b01be92adbb8c1a42c11b8d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c75697a73696c76612d6465762f636a2d73646b2d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/luizsilva-dev/cj-sdk-php)[![License: MIT](https://camo.githubusercontent.com/1b01ef0024ba0866c115986b895301f657c1b21fc29f05c4844b7f2e8d89204d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e7376673f7374796c653d666c61742d737175617265)](https://opensource.org/licenses/MIT)[![PHP Version](https://camo.githubusercontent.com/bd2b103b0a20a0f5b1af35e3e9f1db50dda4cfcda8b01624e2a37206c26ec5bb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344372e342d626c75652e7376673f7374796c653d666c61742d737175617265)](https://php.net)[![GitHub Stars](https://camo.githubusercontent.com/3a62533c5a32eaf42955d360b4a4bec82d9896d268af71df0019c38a9a3ee93a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6c75697a73696c76612d6465762f636a2d73646b2d7068703f7374796c653d666c61742d737175617265)](https://github.com/luizsilva-dev/cj-sdk-php/stargazers)

A comprehensive and **fully tested** PHP SDK for integrating with the CJ Affiliate (Commission Junction) API. Built with Guzzle HTTP client and tested with real CJ credentials to ensure 100% compatibility.

**Developed by:** [Luiz Silva](https://github.com/luizsilva-dev)

🚀 Features
----------

[](#-features)

- ✅ **Link Search API** - Search affiliate links with product information
- ✅ **Advertiser Lookup** - Search and discover advertisers/merchants
- ✅ **Commission Detail** - Real-time commission tracking via GraphQL
- ✅ **Program Terms** - Access program commission rates
- ✅ **Promotional Properties** - Manage PIDs and tracking
- ✅ **Offer Feed** - Access automated offers
- ✅ **Built-in Caching** - File-based caching for performance
- ✅ **XML &amp; JSON Support** - Automatic format detection
- ✅ **Exception Handling** - Comprehensive error handling
- ✅ **Guzzle HTTP Client** - Modern and reliable
- ✅ **PSR-4 Autoloading** - Modern PHP standards

⚠️ Important Note About Product Search
--------------------------------------

[](#️-important-note-about-product-search)

**CJ Affiliate does not offer a public Product Search API.**

After extensive testing with real CJ credentials, we confirmed that:

- The GraphQL Product Search endpoint (`ads.api.cj.com/graphql`) does not exist (404 error)
- Product Feeds are for advertisers to submit products, not for publishers to query

**Solution:** Use the **Link Search API** instead. It returns affiliate links that include product information (names, URLs, commissions, etc.).

See [API\_CHANGES.md](API_CHANGES.md) for details.

💻 Requirements
--------------

[](#-requirements)

- PHP 7.4 or higher
- JSON extension enabled
- XML extension enabled
- Guzzle HTTP client (auto-installed via Composer)
- CJ Affiliate account with API credentials

📦 Installation
--------------

[](#-installation)

### Via Composer (Recommended)

[](#via-composer-recommended)

```
composer require luizsilva-dev/cj-sdk-php
```

### Manual Installation

[](#manual-installation)

```
git clone https://github.com/luizsilva-dev/cj-sdk-php.git
cd cj-sdk-php
composer install
```

Then include in your project:

```
require_once 'vendor/autoload.php';
```

⚡ Quick Start
-------------

[](#-quick-start)

### 1. Get Your CJ API Credentials

[](#1-get-your-cj-api-credentials)

1. Visit [CJ Developer Portal](https://developers.cj.com/)
2. Sign in with your CJ Affiliate credentials
3. Go to **Authentication &gt; Personal Access Tokens**
4. Create a new token
5. Copy your **Personal Access Token**
6. Get your **Publisher ID** (top right corner in CJ Members portal)
7. Get your **Website ID** from Account → Websites

### 2. Initialize the Client

[](#2-initialize-the-client)

```
