PHPackages                             wpcs/php-api-wrapper - 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. wpcs/php-api-wrapper

ActiveLibrary

wpcs/php-api-wrapper
====================

A PHP API wrapper to easily communicate with the WPCS.io API.

v1.1.0(3y ago)173MITPHPPHP &gt;=7.1

Since Jun 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/wpcs/php-api-wrapper)[ Packagist](https://packagist.org/packages/wpcs/php-api-wrapper)[ RSS](/packages/wpcs-php-api-wrapper/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (11)Used By (0)

WPCS PHP API wrapper
====================

[](#wpcs-php-api-wrapper)

A PHP API wrapper to easily communicate with the WPCS.io API.

Authentication
--------------

[](#authentication)

In order to use the package, you need to authenticate with the WPCS API. You can create an API key/secret pair in the console to use for this wrapper.

There are two ways to authenticate the requests with this package: using constants or the builder functions.

### Configuring authentication with builder functions

[](#configuring-authentication-with-builder-functions)

There are three functions to use to authenticate your requests: `setRegion(string $region)`, `setApiKey(string $key)` and `setApiSecret(string $secret)`

Example:

```
$request = new \WPCS\API\GetTenantsRequest();
$response = $request
    ->setRegion('us1') // Or eu1, depending on your region.
    ->setApiKey('an-api-key') // The API Key you retrieved from the console
    ->setApiSecret('an-api-secret') // The API Secret you retrieved from the console
    ->send();
```

This allows you to use your own secrets management.

### Constants

[](#constants)

If you are using, for example, WordPress, it is common to place secrets in the wp-config.php file as constants. You can do this for the wrapper as well. The three required constants are `WPCS_API_REGION`, `WPCS_API_KEY` and `WPCS_API_SECRET`. When these are defined, you do not need to use the builder functions to setup authentication.

Example:

```
define('WPCS_API_REGION', 'us1'); // Or eu1, depending on your region.
define('WPCS_API_KEY', 'an-api-key'); // The API Key you retrieved from the console
define('WPCS_API_SECRET', 'an-api-secret'); // The API Secret you retrieved from the console

// No need to set the region, API key and secret using functions now
$request = new \WPCS\API\GetTenantsRequest();
$response = $request->send();
```

Example usage
-------------

[](#example-usage)

A request to the WPCS API to create a new version might look like this (when not using the constants to authenticate). This request will create a version, based on the last snapshot of the current production version in WPCS in a product that resides in the `US1 region`.

```
$request = new \WPCS\API\CreateVersionRequest();
$response = $request
    ->setRegion('us1')
    ->setApiKey('an-api-key')
    ->setApiSecret('an-api-secret')
    ->setName('v2.0.0')
    ->setWordPressVersion('6.0')
    ->setPhpVersion('7.4')
    ->send();
```

###  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

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.7% 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 ~3 days

Total

10

Last Release

1390d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/44b364c1070c6d7898e457ac90f523ae0f60ad8a5b8ff37ccf155b71f12577dd?d=identicon)[wpcs\_wijnand](/maintainers/wpcs_wijnand)

---

Top Contributors

[![wvleeuwen](https://avatars.githubusercontent.com/u/1822606?v=4)](https://github.com/wvleeuwen "wvleeuwen (18 commits)")[![wpcs](https://avatars.githubusercontent.com/u/108279468?v=4)](https://github.com/wpcs "wpcs (1 commits)")

### Embed Badge

![Health badge](/badges/wpcs-php-api-wrapper/health.svg)

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

PHPackages © 2026

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