Download the PHP package newsdaycom/stackpath-php-sdk without Composer

On this page you can find all versions of the php package newsdaycom/stackpath-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package 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

You can easily add this to your project by running

composer require newsdaycom/stackpath-php-sdk

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

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

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!


All versions of stackpath-php-sdk with dependencies

PHP Build Version
Package Version
Requires guzzlehttp/guzzle Version ^6.3 || ^7.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package newsdaycom/stackpath-php-sdk contains the following files

Loading the files please wait ....