PHPackages                             zohaib-vaival/php-cartzy - 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. zohaib-vaival/php-cartzy

ActiveLibrary[API Development](/categories/api)

zohaib-vaival/php-cartzy
========================

PHP SDK for Cartzy API

2.0.2(5y ago)1252[1 PRs](https://github.com/zohaib-vaival/php-cartzy/pulls)Apache-2.0PHPPHP &gt;=7.1

Since Dec 11Pushed 5y ago1 watchersCompare

[ Source](https://github.com/zohaib-vaival/php-cartzy)[ Packagist](https://packagist.org/packages/zohaib-vaival/php-cartzy)[ Docs](https://github.com/zohaib-vaival/php-cartzy)[ RSS](/packages/zohaib-vaival-php-cartzy/feed)WikiDiscussions main Synced today

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

PHP Cartzy SDK
==============

[](#php-cartzy-sdk)

PHPCartzy is a simple SDK implementation of Cartzy API. It helps accessing the API in an object oriented way.

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

[](#installation)

Install with Composer

```
composer require zohaib-vaival/php-cartzy
```

### Requirements

[](#requirements)

PHPCartzy uses curl extension for handling http calls. So you need to have the curl extension installed and enabled with PHP.

> However if you prefer to use any other available package library for handling HTTP calls, you can easily do so by modifying 1 line in each of the `get()`, `post()`, `put()`, `delete()` methods in `PHPCartzy\HttpRequestJson` class.

Usage
-----

[](#usage)

You can use PHPCartzy in a pretty simple object oriented way.

#### Configure CartzySDK

[](#configure-cartzysdk)

If you are using your own private API, provide the ApiKey and Password.

```
$config = array(
    'ShopUrl' => 'yourshop.cartzy.com',
    'ApiKey' => '***YOUR-PRIVATE-API-KEY***',
    'Password' => '***YOUR-PRIVATE-API-PASSWORD***',
);

PHPCartzy\CartzySDK::config($config);
```

For Third party apps, use the permanent access token.

```
$config = array(
    'ShopUrl' => 'yourshop.cartzy.com',
    'AccessToken' => '***ACCESS-TOKEN-FOR-THIRD-PARTY-APP***',
);

PHPCartzy\CartzySDK::config($config);
```

##### How to get the permanent access token for a shop?

[](#how-to-get-the-permanent-access-token-for-a-shop)

There is a AuthHelper class to help you getting the permanent access token from the shop using oAuth.

1. First, you need to configure the SDK with additional parameter SharedSecret

```
$config = array(
    'ShopUrl' => 'yourshop.cartzy.com',
    'ApiKey' => '***YOUR-PRIVATE-API-KEY***',
    'SharedSecret' => '***YOUR-SHARED-SECRET***',
);

PHPCartzy\CartzySDK::config($config);
```

2. Create the authentication request

> The redirect url must be white listed from your app admin as one of **Application Redirect URLs**.

```
//your_authorize_url.php
$scopes = 'read_products,write_products,read_script_tags,write_script_tags';
//This is also valid
//$scopes = array('read_products','write_products','read_script_tags', 'write_script_tags');
$redirectUrl = 'https://yourappurl.com/your_redirect_url.php';

\PHPCartzy\AuthHelper::createAuthRequest($scopes, $redirectUrl);
```

> If you want the function to return the authentication url instead of auto-redirecting, you can set the argument `$return` (5th argument) to `true`.

```
\PHPCartzy\AuthHelper::createAuthRequest($scopes, $redirectUrl, null, null, true);
```

3. Get the access token when redirected back to the `$redirectUrl` after app authorization.

```
//your_redirect_url.php
PHPCartzy\CartzySDK::config($config);
$accessToken = \PHPCartzy\AuthHelper::getAccessToken();
//Now store it in database or somewhere else
```

> You can use the same page for creating the request and getting the access token (redirect url). In that case just skip the 2nd parameter `$redirectUrl` while calling `createAuthRequest()` method. The AuthHelper class will do the rest for you.

```
//your_authorize_and_redirect_url.php
PHPCartzy\CartzySDK::config($config);
$accessToken = \PHPCartzy\AuthHelper::createAuthRequest($scopes);
//Now store it in database or somewhere else
```

#### Get the CartzySDK Object

[](#get-the-cartzysdk-object)

```
$Cartzy = new PHPCartzy\CartzySDK;
```

You can provide the configuration as a parameter while instantiating the object (if you didn't configure already by calling `config()` method)

```
$Cartzy = new PHPCartzy\CartzySDK($config);
```

#### Discount Code

[](#discount-code)

You can get list of discount codes created in store admin.

```
$config = array(
    'ClientID' => '***CLIENT-ID-FOR-THIRD-PARTY-APP***',
    'ShopUrl' => 'yourshop.cartzy.com',
    'AccessToken' => '***ACCESS-TOKEN-FOR-THIRD-PARTY-APP***',
);

PHPCartzy\CartzySDK::config($config);
$discountCode = new PHPCartzy\Discount\DiscountCode();
$resp = $discountCode->get();
```

Reference
---------

[](#reference)

- [Cartzy API Reference](https://help.cartzy.com/api/reference/)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

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 ~21 days

Total

3

Last Release

1934d ago

Major Versions

1.0.0 → 2.0.12021-01-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/691e346405e41eb8da2b3ef5ec19d3e7ccebd47bb812f82453f2705d26b4d0fc?d=identicon)[zohaib-vaival](/maintainers/zohaib-vaival)

---

Top Contributors

[![zohaib-vaival](https://avatars.githubusercontent.com/u/75828851?v=4)](https://github.com/zohaib-vaival "zohaib-vaival (14 commits)")

---

Tags

phpsdkCartzy

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zohaib-vaival-php-cartzy/health.svg)

```
[![Health](https://phpackages.com/badges/zohaib-vaival-php-cartzy/health.svg)](https://phpackages.com/packages/zohaib-vaival-php-cartzy)
```

###  Alternatives

[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

47073.9k5](/packages/deepseek-php-deepseek-php-client)[jstolpe/instagram-graph-api-php-sdk

Instagram Graph API PHP SDK

13998.4k2](/packages/jstolpe-instagram-graph-api-php-sdk)[octw/aramex

A Library to integrate with Aramex APIs

2925.2k](/packages/octw-aramex)

PHPackages © 2026

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