PHPackages                             newsdaycom/stackpath-php-sdk - 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. newsdaycom/stackpath-php-sdk

ActiveLibrary[API Development](/categories/api)

newsdaycom/stackpath-php-sdk
============================

A PHP SDK for Stackpath

1.2.0(5y ago)4221.0k↓50%3[3 PRs](https://github.com/newsdaycom/stackpath-php-sdk/pulls)MITPHP

Since Sep 24Pushed 3y ago5 watchersCompare

[ Source](https://github.com/newsdaycom/stackpath-php-sdk)[ Packagist](https://packagist.org/packages/newsdaycom/stackpath-php-sdk)[ RSS](/packages/newsdaycom-stackpath-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (8)Used By (0)

StackPath PHP SDK
=================

[](#stackpath-php-sdk)

This package was written to make connections to the StackPath API easier in PHP. We will maintain it for as long as makes sense for us and had the primary goal of adding purge request logic to it, which we've done.

Other abstraction methods will be forthcoming as we require it.

This package is open source and we are open to pull requests for new features.

Install
-------

[](#install)

You can easily add this to your project by running

```
composer require newsdaycom/stackpath-php-sdk

```

Configuration
-------------

[](#configuration)

For simplicity sake, we encourage you to set two environment variables, `STACKPATH_ID` and `STACKPATH_SECRET`. If you cannot do this you can also provide the client\_id and client\_secret as parameters during instantiation. The OAuth handshake happens on instantiation and the bearer token is provided in all requests by default.

Use
---

[](#use)

To use Stackpath you must first instantiate the class and include your client\_id, client\_secret and stack\_id;

```
$sp = new \StackPath\StackPath("9ad4bdfc-77ec-41bb-ac95-da137d837742", $CLIENT_ID, $CLIENT_SECRET);

```

If you don't provide the $CLIENT\_ID or $CLIENT\_SECRET the class will fallback on your environment variables.

There are request methods set up by default, `GET`, `POST`, `DELETE`, and `PUT`. These are all shorthand methods for the `request` method which handles all of the logic for Authorization, payload and returning the response as an object. The requests in this application are powered by Guzzle.

The URLs you provide should begin with what comes after `https://gateway.stackpath.com` in your API calls. The gateway is filled in automatically. Absolute URLs can also be used.

For example, requesting a token can be done as follows:

```
$this->post("identity/v1/oauth2/token", ["json" => [
          "client_id" => $this->creds["client_id"],
          "client_secret" => $this->creds["client_secret"],
          "grant_type" => "client_credentials"
        ]])->access_token

```

Note, the response will come back as an object so you can treat the method like one. Most of the payloads you send to stackpath can begin with

```
["json" => [ARRAY OF DATA]]

```

Docs
----

[](#docs)

At the time this README was written, documentation can be found in PHPDoc comment notation in src/StackPath/StackPath.php. If you have questions not answered here, reach out via GitHub ticket.

Enjoy!

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity67

Established project with proven stability

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

Total

5

Last Release

1956d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/37019bdee214a7c80eb88e384f86600b43f7e6439425beacb56b738a485f1dd8?d=identicon)[tcmccarthy](/maintainers/tcmccarthy)

---

Top Contributors

[![tc-mccarthy](https://avatars.githubusercontent.com/u/2780378?v=4)](https://github.com/tc-mccarthy "tc-mccarthy (9 commits)")

### Embed Badge

![Health badge](/badges/newsdaycom-stackpath-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/newsdaycom-stackpath-php-sdk/health.svg)](https://phpackages.com/packages/newsdaycom-stackpath-php-sdk)
```

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