PHPackages                             keboola/kbc-manage-api-php-client - 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. keboola/kbc-manage-api-php-client

ActiveLibrary[API Development](/categories/api)

keboola/kbc-manage-api-php-client
=================================

Keboola Management API Client

v10.0.0(4mo ago)156.5k↓18.5%23MITAPI BlueprintPHP &gt;=8.2CI passing

Since Oct 15Pushed 2mo ago17 watchersCompare

[ Source](https://github.com/keboola/kbc-manage-api-php-client)[ Packagist](https://packagist.org/packages/keboola/kbc-manage-api-php-client)[ RSS](/packages/keboola-kbc-manage-api-php-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (478)Used By (3)

Keboola Manage API PHP client
=============================

[](#keboola-manage-api-php-client)

[![Build on master](https://github.com/keboola/kbc-manage-api-php-client/actions/workflows/master.yml/badge.svg?branch=master)](https://github.com/keboola/kbc-manage-api-php-client/actions/workflows/master.yml)

Simple PHP wrapper library for [Keboola Management REST API](http://docs.keboolamanagementapi.apiary.io/#)

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

[](#installation)

Library is available as composer package. To start using composer in your project follow these steps:

**Install composer**

```
curl -s http://getcomposer.org/installer | php
mv ./composer.phar ~/bin/composer # or /usr/local/bin/composer
```

**Create composer.json file in your project root folder:**

```
{
    "require": {
        "php" : ">=8.1",
        "keboola/kbc-manage-api-php-client": "~0.0"
    }
}
```

**Install package:**

```
composer install
```

**Add autoloader in your bootstrap script:**

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

Read more in [Composer documentation](http://getcomposer.org/doc/01-basic-usage.md)

Usage examples
--------------

[](#usage-examples)

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

use Keboola\ManageApi\Client;

$client = new Client([
    'token' => getenv('MY_MANAGE_TOKEN'),
    'url' => 'https://connnection.keboola.com',
]);

$project = $client->getProject(234);
```

Tests
-----

[](#tests)

The main purpose of these test is "black box" test driven development of Keboola Connection. These test guards the API implementation. You can run these tests only against non-production environments.

Tests requires valid Keboola Management API tokens and an endpoint URL of the API test environment.

*Note: For automated tests, the tests are run again three times by default if they fail. For local development this would be quite annoying, so you can disable this by creating new file `phpunit-retry.xml` from `phpunit-retry.xml.dist`*

*Note: The test environment should be running a cronjob for `token-expirator` otherwise the `testTemporaryAccess` test will fail.*

Create file `.env` with environment variables`:

```
# REQUIRED - must be filled before running any test
KBC_MANAGE_API_URL=https://connection.keboola.com  # URL where Keboola Connection is running
KBC_MANAGE_API_TOKEN=your_token # manage api token assigned to user **with** **superadmin** privileges. Can be created in Account Settings under the title Personal Access Tokens. User must have Multi-Factor Authentication disabled.
KBC_SUPER_API_TOKEN=your_token # can be created in manage-apps on the Tokens tab
KBC_MANAGE_API_SUPER_TOKEN_WITH_PROJECTS_READ_SCOPE=super_token_with_projects_read_scope # can be created in manage-apps on the Tokens tab. Token must have "projects:read" scope
KBC_MANAGE_API_SUPER_TOKEN_WITHOUT_SCOPES=super_token_without_scopes
KBC_MANAGE_API_SUPER_TOKEN_WITH_DELETED_PROJECTS_READ_SCOPE=super_token_with_deleted_projects_read_scope # can be created in manage-apps on the Tokens tab. Token must have "deleted-projects:read" scope
KBC_MANAGE_API_SUPER_TOKEN_WITH_UI_MANAGE_SCOPE=super_token_with_ui_manage_scope # can be created in manage-apps on the Tokens tab. Token must have "connection:ui-manage" scope
KBC_MANAGE_API_SUPER_TOKEN_WITH_ORGANIZATIONS_READ_SCOPE=super_token_with_organizations_read # can be created in manage-apps on the Tokens tab. Token must have "organizations:read" scope
KBC_MANAGE_API_SUPER_TOKEN_WITH_STORAGE_TOKENS_SCOPE=super_token_with_storage_tokens_scope # can be created in manage-apps on the Tokens tab. Token must have "manage:storage-tokens" scope
KBC_TEST_MAINTAINER_ID=id # `id` of maintainer. Please create a new maintainer dedicated to test suite. All maintainer's organizations and projects all purged before tests!
KBC_TEST_ADMIN_EMAIL=email_of_another_admin_having_mfa_disabled # email address of another user without any organizations
KBC_TEST_ADMIN_TOKEN=token_of_another_admin_having_mfa_disabled # is also a Personal Access Token of user **without** **superadmin** privileges , but for a different user than that which has `KBC_MANAGE_API_TOKEN`. User must have Multi-Factor Authentication disabled.
KBC_TEST_ADMIN_WITH_MFA_EMAIL=email_of_another_admin_having_mfa_enabled # email address of another user without any organizations and having Multi-Factor Authentication enabled
KBC_TEST_ADMIN_WITH_MFA_TOKEN=token_of_another_admin_having_mfa_enabled # is also a Personal Access Token of user **without** **superadmin** privileges , but for a different user than that which has `KBC_MANAGE_API_TOKEN` or `KBC_TEST_ADMIN_TOKEN`
KBC_TEST_UNVERIFIED_ADMIN_TOKEN=token_of_unverified_admin_having_mfa_disabled # is a Personal Access Token of user with **isActivated=false** and **without** **superadmin** privileges, but for a different user than that which has `KBC_MANAGE_API_TOKEN`.

# OPTIONAL - required only for running testCreateStorageBackend, you have to have new snowflake backend and fill credentials into following environment variables
KBC_TEST_SNOWFLAKE_BACKEND_NAME=
KBC_TEST_SNOWFLAKE_BACKEND_PASSWORD=
KBC_TEST_SNOWFLAKE_HOST=
KBC_TEST_SNOWFLAKE_WAREHOUSE=
KBC_TEST_SNOWFLAKE_BACKEND_REGION=
```

OPTIONAL - required only for running StorageBackendTest::testCreateStorageBackendWithCert, you have to have new snowflake backend and fill credentials into following environment variables
===========================================================================================================================================================================================

[](#optional---required-only-for-running-storagebackendtesttestcreatestoragebackendwithcert-you-have-to-have-new-snowflake-backend-and-fill-credentials-into-following-environment-variables)

Prepare credentials for Snowflake access Create RSA key pair for Snowflake user, you can use the following command to generate it:

```
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt
openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub
```

Then you can use the public key in the Snowflake user creation script below.

To get the public key in one line (without header and footer) you can use:

```
PUBLIC_KEY=$(sed '1d;$d' rsa_key.pub | tr -d '\n')
# add this to CREATE USER statement
echo "RSA_PUBLIC_KEY='${PUBLIC_KEY}'"
```

```
CREATE ROLE "CI_MANAGE_TEST_USER";
CREATE DATABASE "CI_MANAGE_TEST_USER";
GRANT CREATE DATABASE ON ACCOUNT TO ROLE "CI_MANAGE_TEST_USER";
GRANT CREATE ROLE ON ACCOUNT TO ROLE "CI_MANAGE_TEST_USER" WITH GRANT OPTION;
GRANT CREATE USER ON ACCOUNT TO ROLE "CI_MANAGE_TEST_USER" WITH GRANT OPTION;

CREATE WAREHOUSE "CI_MANAGE_TEST_USER" WITH WAREHOUSE_SIZE = 'XSMALL' WAREHOUSE_TYPE = 'STANDARD' AUTO_SUSPEND = 60 AUTO_RESUME = TRUE;
GRANT USAGE ON WAREHOUSE "CI_MANAGE_TEST_USER" TO ROLE "CI_MANAGE_TEST_USER" WITH GRANT OPTION;

CREATE USER "CI_MANAGE_TEST_USER"
  DEFAULT_ROLE = "CI_MANAGE_TEST_USER"
  RSA_PUBLIC_KEY = ''
;

GRANT ROLE ACCOUNTADMIN TO USER CI_MANAGE_TEST_USER;
GRANT ROLE "CI_MANAGE_TEST_USER" TO USER "CI_MANAGE_TEST_USER";
GRANT ROLE "CI_MANAGE_TEST_USER" TO ROLE SYSADMIN;

```

set up env variables:

For local tests and CI we need to edit the private key to one line and trim `-----BEGIN PRIVATE KEY----- -----END PRIVATE KEY-----` We can do this with `cat rsa_key.p8 | sed '1d;$d' | tr -d '\n'`

```
# set private key in your local .env file
PRIVATE_KEY=$(sed '1d;$d' rsa_key.p8 | tr -d '\n'); if [ -f .env ]; then awk -v v="KBC_TEST_MAIN_SNOWFLAKE_BACKEND_PRIVATE_KEY=\"$PRIVATE_KEY\"" 'BEGIN{r=0} /^KBC_TEST_MAIN_SNOWFLAKE_BACKEND_PRIVATE_KEY=/{print v; r=1; next} {print} END{if(!r) print v}' .env > .env.tmp && mv .env.tmp .env; else printf '%s\n' "KBC_TEST_MAIN_SNOWFLAKE_BACKEND_PRIVATE_KEY=\"$PRIVATE_KEY\"" > .env; fi
```

```
# user must be on the same host as KBC_TEST_SNOWFLAKE_HOST
KBC_TEST_MAIN_SNOWFLAKE_BACKEND_NAME=CI_MANAGE_TEST_USER
KBC_TEST_MAIN_SNOWFLAKE_BACKEND_PRIVATE_KEY= # note: it has to be full private key in PEM format, including the header and footer
KBC_TEST_MAIN_SNOWFLAKE_BACKEND_DATABASE=CI_MANAGE_TEST_USER
KBC_TEST_MAIN_SNOWFLAKE_BACKEND_WAREHOUSE=CI_MANAGE_TEST_USER
KBC_TEST_SNOWFLAKE_BACKEND_STACK_PREFIX= same as value `KEBOOLA_STORAGE_API__CLIENT_DB_PREFIX` in connection
```

If any of the environment variables are not set, the tests will fail with an error message explaining which variable is missing.

Run tests

```
docker-compose run --rm dev composer tests
```

File Storage tests
------------------

[](#file-storage-tests)

### Setup cloud resources for File Storage tests

[](#setup-cloud-resources-for-file-storage-tests)

#### Prerequisites:

[](#prerequisites)

- configured and logged in az, aws and gcp CLI tools
    - `az login`
    - `aws sso login --profile=`
    - `gcloud auth application-default login`
- installed terraform () and jq () to setup local env

```
# create terraform.tfvars file from terraform.tfvars.dist
cp ./provisioning/terraform.tfvars.dist ./provisioning/terraform.tfvars

# set terraform variables
name_prefix = "" # your name/nickname to make your resource unique & recognizable, allowed characters are [a-zA-Z0-9-]
gcp_storage_location = "" # region of GCP resources
gcp_project_id = "" # GCP project id
gcp_project_region = "" # region of GCP project
azure_storage_location = "" # region of Azure resources
azure_tenant_id = "" # Azure tenant id
azure_subscription_id = "" # Azure subscription id
aws_profile = ""  # your aws profile name
aws_region = "" # region of AWS resources
aws_account = "" # your aws account id

# Initialize terraform
terraform -chdir=./provisioning init
# Create resources
terraform -chdir=./provisioning apply

# For destroying resources run
terraform -chdir=./provisioning apply -destroy

# Setup terraform variables to .env file (will be prepended to .env file)
# For Azure
./provisioning/update-env.sh azure
# For Aws
./provisioning/update-env.sh aws
# For GCP
./provisioning/update-env.sh gcp
```

### Required variables for File Storage tests

[](#required-variables-for-file-storage-tests)

These variables are used for testing file storage. You have to copy these values from Azure and AWS portal.

- `TEST_ABS_ACCOUNT_KEY` - First secret key for Azure Storage account
- `TEST_ABS_ACCOUNT_NAME` - Name of Azure Storage account
- `TEST_ABS_CONTAINER_NAME` - Name of container created inside Azure Storage Account
- `TEST_ABS_REGION` - Name of region where Azure Storage Account is located. (Note: AWS region list is used)
- `TEST_ABS_ROTATE_ACCOUNT_KEY` - Second secret key for Azure Storage account
- `TEST_S3_ROTATE_KEY` - Second AWS key
- `TEST_S3_ROTATE_SECRET` - Second AWS secret
- `TEST_S3_FILES_BUCKET` - Name of file bucket on S3
- `TEST_S3_KEY` - First AWS key
- `TEST_S3_REGION` - Region where your S3 is located
- `TEST_S3_SECRET` - First AWS secret
- `TEST_GCS_KEYFILE_JSON` - First GCS key file contents as json string
- `TEST_GCS_KEYFILE_ROTATE_JSON` - Second GCS key file contents as json string used for testing rotation
- `TEST_GCS_FILES_BUCKET` - Name of file bucket on GCS
- `TEST_GCS_REGION` - Region whare GCS is located

Variable prefixed with *ROTATE* are used for rotating credentials and they MUST be working credentials.

### Run File Storage tests

[](#run-file-storage-tests)

```
docker-compose run --rm dev composer tests-file-storage
```

Build OpenAPI document
----------------------

[](#build-openapi-document)

Currently, we mainly document APIs in apiary.apib file. But we want to move to OpenAPI format. By calling following commands, the apiary.apib file will be translated to OpenAPI format and stored in file openapi.yml. Then you can commit it. We should put it in CI.

You need to install `apib2swagger` [tool](https://github.com/kminami/apib2swagger) .

```
$ npm install -g apib2swagger

```

Then run following commands

```
$ cat apiary.apib | grep -v "X-KBC-ManageApiToken:" | apib2swagger -o openapi.yml -y --open-api-3 --info-title="Manage API"
# or in docker
$ docker-compose run --rm openapi
$ php AdjustOpenApi.php

```

License
-------

[](#license)

MIT licensed, see [LICENSE](./LICENSE) file.

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance80

Actively maintained with recent releases

Popularity32

Limited adoption so far

Community31

Small or concentrated contributor base

Maturity95

Battle-tested with a long release history

 Bus Factor4

4 contributors hold 50%+ of commits

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

Recently: every ~181 days

Total

42

Last Release

139d ago

Major Versions

5.2.0 → 6.0.02022-08-01

6.1.0 → 7.0.02023-04-18

v7.1.1 → v8.0.02024-12-03

v8.0.0 → v9.0.02025-03-05

v9.0.0 → v10.0.02025-12-30

PHP version history (5 changes)2.3.0PHP ^7.1

3.3.0PHP ^7.1|^8.0

4.0.0PHP ^7.4|^8.0

v8.0.0PHP &gt;=8.1

v10.0.0PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/101dbf2551a0709ddab522f97669f13a2c4cc2d0a1e8d009f3af6ba80accb1a9?d=identicon)[Keboola](/maintainers/Keboola)

---

Top Contributors

[![ErikZigo](https://avatars.githubusercontent.com/u/1726727?v=4)](https://github.com/ErikZigo "ErikZigo (230 commits)")[![romanbracinik](https://avatars.githubusercontent.com/u/6448364?v=4)](https://github.com/romanbracinik "romanbracinik (190 commits)")[![Halama](https://avatars.githubusercontent.com/u/903531?v=4)](https://github.com/Halama "Halama (166 commits)")[![jirkasemmler](https://avatars.githubusercontent.com/u/13363655?v=4)](https://github.com/jirkasemmler "jirkasemmler (133 commits)")[![tomasfejfar](https://avatars.githubusercontent.com/u/642928?v=4)](https://github.com/tomasfejfar "tomasfejfar (87 commits)")[![ujovlado](https://avatars.githubusercontent.com/u/419849?v=4)](https://github.com/ujovlado "ujovlado (69 commits)")[![yustme](https://avatars.githubusercontent.com/u/5272798?v=4)](https://github.com/yustme "yustme (62 commits)")[![ondrajodas](https://avatars.githubusercontent.com/u/12143866?v=4)](https://github.com/ondrajodas "ondrajodas (54 commits)")[![vojtabiberle](https://avatars.githubusercontent.com/u/528942?v=4)](https://github.com/vojtabiberle "vojtabiberle (52 commits)")[![pivnicek](https://avatars.githubusercontent.com/u/569139?v=4)](https://github.com/pivnicek "pivnicek (40 commits)")[![martinjunger](https://avatars.githubusercontent.com/u/84506613?v=4)](https://github.com/martinjunger "martinjunger (38 commits)")[![martinjandl](https://avatars.githubusercontent.com/u/18183860?v=4)](https://github.com/martinjandl "martinjandl (24 commits)")[![MiroCillik](https://avatars.githubusercontent.com/u/1488015?v=4)](https://github.com/MiroCillik "MiroCillik (11 commits)")[![themark147](https://avatars.githubusercontent.com/u/17779619?v=4)](https://github.com/themark147 "themark147 (9 commits)")[![devin-ai-integration[bot]](https://avatars.githubusercontent.com/in/811515?v=4)](https://github.com/devin-ai-integration[bot] "devin-ai-integration[bot] (5 commits)")[![pepamartinec](https://avatars.githubusercontent.com/u/271753?v=4)](https://github.com/pepamartinec "pepamartinec (5 commits)")[![ondrejhlavacek](https://avatars.githubusercontent.com/u/497675?v=4)](https://github.com/ondrejhlavacek "ondrejhlavacek (3 commits)")[![martinsifra](https://avatars.githubusercontent.com/u/1210906?v=4)](https://github.com/martinsifra "martinsifra (2 commits)")[![kacurez](https://avatars.githubusercontent.com/u/1412120?v=4)](https://github.com/kacurez "kacurez (2 commits)")[![hhanova](https://avatars.githubusercontent.com/u/16991227?v=4)](https://github.com/hhanova "hhanova (2 commits)")

### Embed Badge

![Health badge](/badges/keboola-kbc-manage-api-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/keboola-kbc-manage-api-php-client/health.svg)](https://phpackages.com/packages/keboola-kbc-manage-api-php-client)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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