PHPackages                             gplcart/api - 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. gplcart/api

ActiveGplcart-module[API Development](/categories/api)

gplcart/api
===========

A helper module to implement Web API based on JWT authorization

01PHP

Since Mar 9Pushed 8y agoCompare

[ Source](https://github.com/gplcart/api)[ Packagist](https://packagist.org/packages/gplcart/api)[ RSS](/packages/gplcart-api/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/eb549b99cc43eb1bf9369fac79abcfb8af1e36afc9050ffed4c6f67110cadf39/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f67706c636172742f6170692f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/gplcart/api/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/3f98b481aeade9a785157223da41b238be697ee87c8e27255f61b34e9638376a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f67706c636172742f6170692f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/gplcart/api/?branch=master)

API is a [GPL Cart](https://github.com/gplcart/gplcart) module that helps to implement WEB API for your GPLCart. Basically it provides a simple authorization mechanism based on [JWT tokens](https://jwt.io) and uses other modules for processing API requests. It does nothing by itself, so do not install unless other modules require it.

**Dependencies**

- [Oauth module](https://github.com/gplcart/oauth)

**Installation**

1. Download and extract to `system/modules` manually or using composer `composer require gplcart/api`. IMPORTANT: If you downloaded the module manually, be sure that the name of extracted module folder doesn't contain a branch/version suffix, e.g `-master`. Rename if needed.
2. Go to `admin/module/list` end enable the module
3. Ajust module settings at `admin/module/settings/api`
4. Grant module permissions to other administrators at `admin/user/role`
5. Add some API users at `admin/user/api`

**Usage**

Look at `example.php` for code samples. API endpoint - . This URL is used for initial login to get an access token. Once you got the token you are able to query API with URL arguments, e.g: . You can pass API version as a query parameter: . Note: there is no way (yet) to refresh access tokens. You should re-login after your access token has expired.

**Processors**

Since the module does not process API requests by itself, you should use another module for this. The processor is responsible for system calls using an array of arguments from URL. This is how the `module.api.process` hook must be implemented in a module:

```
public function hookModuleApiProcess(array $params, array $user, &$response, $controller){

	$query = $params['query']; // GET query array
	$version = isset($query['version']) ? $query['version'] : 1; // API version

	list($arg1, $arg2) = $params['arguments']; // Exploded path arguments

	if($arg1 === 'products'){
		$response = array(...); // An array of products to be delivered to a client
}

```

By default all data from processors is delivered in JSON format. If you need another format then implement hook `module.api.output`

```
public function hookModuleApiOutput(array $arguments, array $user, $response, $controller){
    // Don't forget to set all needed headers
	echo $this->arrayToXml($response);
	exit; // Important. Abort further processing
}

```

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ad45895ef2d2867dc5294b7581948c79eef568001241d98eaf631bfe9fadeb63?d=identicon)[gplcart](/maintainers/gplcart)

---

Top Contributors

[![gplcart](https://avatars.githubusercontent.com/u/16158956?v=4)](https://github.com/gplcart "gplcart (11 commits)")

---

Tags

api-gatewayecommercegplcartgplcart-modulejwt-authenticationphpshopping-cartweb-api

### Embed Badge

![Health badge](/badges/gplcart-api/health.svg)

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M19](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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