PHPackages                             bueffelsoft/cyclos-rest-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. [HTTP &amp; Networking](/categories/http)
4. /
5. bueffelsoft/cyclos-rest-api

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

bueffelsoft/cyclos-rest-api
===========================

PHP client for the Cyclos REST API

1.4.1(6mo ago)11052MITPHPPHP ^8.4CI failing

Since Apr 21Pushed 6mo ago3 watchersCompare

[ Source](https://github.com/bueffelSOFT/cyclos-rest-api)[ Packagist](https://packagist.org/packages/bueffelsoft/cyclos-rest-api)[ Docs](https://github.com/bueffelSOFT/cyclos-rest-api)[ RSS](/packages/bueffelsoft-cyclos-rest-api/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (3)Versions (14)Used By (0)

Cyclos REST-API Client
======================

[](#cyclos-rest-api-client)

[![Latest Stable Version](https://camo.githubusercontent.com/db3d51172f8e6c7a49cd12194cc084db01c35f9736031cc2cc1b7e046f9d7dc4/68747470733a2f2f706f7365722e707567782e6f72672f6275656666656c736f66742f6379636c6f732d726573742d6170692f762f737461626c652e706e67)](https://packagist.org/packages/bueffelsoft/cyclos-rest-api) [![License](https://camo.githubusercontent.com/64e169d5be8c4e1b6f724c2acced5722bf1ec9dc513038e4a2d4eda18b53d0ef/68747470733a2f2f706f7365722e707567782e6f72672f6275656666656c736f66742f6379636c6f732d726573742d6170692f6c6963656e73652e706e67)](https://packagist.org/packages/bueffelsoft/cyclos-rest-api)

Use this as dependency in your project instead of writing your own client. Auto-generation via swagger codegen (currently, 2020-05-06) produces no usable result. Always use Access-Tokens instead of username//password for best security and easy blocking of individual clients!

```
composer require bueffelsoft/cyclos-rest-api
```

Usage ApiWrapper
----------------

[](#usage-apiwrapper)

The `ApiWrapper` bundles code generated by the swagger codegen to access any API, it has no endpoint specific functions / models.

```
$config = Cyclos\Api\Configuration::getDefaultConfiguration()
    ->setHost('https://cyclos-domain.tld/{network/}api')
    ->setApiKey('Access-Client-Token', '{client-tag}{access-token}')
    // or via the session token if one already exists for the end user:
    //->setApiKey('Session-Token', '{session-token}')
;
$wrapper = new \Cyclos\Api\ApiWrapper($config);

// see createRequest() doc for more parameters
$req = $wrapper->createRequest('/auth');

// see doRequest() doc for more parameters and response type

try {
    $res = $wrapper->doRequest($req);
}
catch(\Exception $e) {
  // $e = \Cyclos\Api\ApiException | \GuzzleHttp\Exception\GuzzleException
}

var_dump($res);

```

Usage of CyclosWrapper
----------------------

[](#usage-of-cycloswrapper)

While ApiWrapper is not specific to the Cyclos API the `CyclosWrapper`is a subclass of it, implementing helper functions to access some of the endpoints. Create a config object as shown above and use it to create a new `CyclosWrapper`. Wrap the calls in a try-catch to check for Exceptions indicating failed requests. If the exception is an `ApiException` the server responded with an error, see CyclosWrapper::loginUser for example handling.

```
use Cyclos\Api\CyclosWrapper;

$wrapper = new CyclosWrapper($config);

// find all users in one or more groups
$users = $wrapper->getUsers(['climate_project']);

// get data for a single user
$user = $wrapper->getUser('username|userId');

// login a user to retrieve a sessionToken and the users data
// IP/remoteAddress is used to block the user after X failed tries
$data = $wrapper->loginUser('username|userId', 'password', $_SERVER['REMOTE_ADDR'] ?? 'cli');

// get all accounts for a given user, may be filtered by account type
// (e.g. to specify the currency)
$accounts = $wrapper->getUserAccounts("username|userId", 'accountTypeId');

// get all advertisements, may be filtered by owner, status, custom fields, ...
$ads = $wrapper->getAdvertisements([
   'owner'        => "-310719030079881031",
   'kind'         => 'webshop',
   'statuses'     => ['active'],
   'customFields' => 'anzeigenart:co2_compensation',
]);

// add an item with the given quantity to the current users shopping cart
$items = $wrapper->addItemToCart("-4922405048507268931", 1.2);

// get a list of all carts for the current user (one per seller & currency)
$carts = $res = $wrapper->getShoppingCarts();

// remove a shopping cart, to cancel the process
$remainingData = $wrapper->deleteShoppingCart('-4922405048507268930');

// get data required to complete the sale, returns the current
// users addresses, possible delivery methods & payment types etc.
$data = $wrapper->getCheckoutData('-4922405048507268930');

// checkout the given cart, using the fetched data, this creates an order,
// waiting to be accepted by the seller
$remainingData = $wrapper->checkoutShoppingCart('-4922405048507268930', [
    'deliveryAddress' => $data['addresses'][0],
    'deliveryMethod' => $data['deliveryMethods'][0]['id'],
    'paymentType' => $data['paymentTypes'][0]['id'],
]);

```

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance68

Regular maintenance activity

Popularity13

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 95.8% 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 ~186 days

Recently: every ~345 days

Total

11

Last Release

189d ago

PHP version history (5 changes)1.0.0PHP &gt;=7.2

1.2.0PHP ^7.4.9

1.3.0PHP ^7.4.9|^8.0

1.4.0PHP ^8.2

1.4.1PHP ^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/114239?v=4)[Jakob Schumann](/maintainers/j-schumann)[@j-schumann](https://github.com/j-schumann)

![](https://www.gravatar.com/avatar/3921e6fd3b27baf15cad173427cdb855b727bba79cb05b014ceca50ac38d0870?d=identicon)[bueffelSOFT](/maintainers/bueffelSOFT)

---

Top Contributors

[![j-schumann](https://avatars.githubusercontent.com/u/114239?v=4)](https://github.com/j-schumann "j-schumann (46 commits)")[![subnoodle](https://avatars.githubusercontent.com/u/9478590?v=4)](https://github.com/subnoodle "subnoodle (2 commits)")

---

Tags

phpapirestCyclos

### Embed Badge

![Health badge](/badges/bueffelsoft-cyclos-rest-api/health.svg)

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

###  Alternatives

[onesignal/onesignal-php-api

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

34199.5k2](/packages/onesignal-onesignal-php-api)[zenditplatform/zendit-php-sdk

PHP client for Zendit API

1194.4k](/packages/zenditplatform-zendit-php-sdk)[elasticemail/elasticemail-php

The PHP library for the Elastic Email REST API. This API is based on the REST API architecture, allowing the user to easily manage their data with this resource-based approach. To start using this API, you will need your Access Token. Remember to keep it safe.

14107.5k2](/packages/elasticemail-elasticemail-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)[huaweicloud/huaweicloud-sdk-php

Huawei Cloud SDK for PHP

1830.2k2](/packages/huaweicloud-huaweicloud-sdk-php)

PHPackages © 2026

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