Download the PHP package echo-five/sparky-api-client-php without Composer

On this page you can find all versions of the php package echo-five/sparky-api-client-php. 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 sparky-api-client-php

Sparky API Client PHP

PHP Version Size License

A PHP client library for the Sparky API.

Menu

Requirements

PHP 8.3 or higher with cURL, JSON, Sodium and Ctype extensions

Installation

How to install?

This package can be installed via Composer:

How to update?

Use the following command to update this package only:

How to remove?

This package can be uninstalled via Composer:

Get started

Prerequisites

Create a new blank PHP file and copy the code below:

This example is stored in the project and can be downloaded here: GetStartedSimpleRequest.php

Features

Simple request vs Signed request

The library allows two types of requests:

Signed requests, although a bit slower, are therefore more secure than simple requests.

How it works

Signing requests is very straightforward!
The only thing to do is to provide your API Signature Key when you instantiate the library.
Then all requests will be automatically signed!

This example is stored in the project and can be downloaded here: GetStartedSignedRequest.php

IMPORTANT

Debugging

Troubleshooting an API can sometimes be challenging.
The library includes a debugging mode to help you better understand how requests are built and sent.

The debugging mode allows to:

Using the debugging mode is very easy!
Just start it at a specific breakpoint and stop it at another.

See Available methods section for more debugging options.
This example is stored in the project and can be downloaded here: GetStartedDebugging.php

Here is an example of the debugging information:

Available methods

Request

This method allows to make an API request.

request(string $requestType, string $requestEndpoint, array <$requestParams>, string <$requestMode>)

This method returns the class instance itself, not the result of the request.
The request result must be retrieved using another method (getResponse).
For convenience, this method is chainable.

Example:

Get Response

This method allows to get the response of the request.

getResponse(bool <$object>)

Usage examples:

This method returns a raw JSON string or a PHP object, depending on the passed argument.
The request response is always a full API response.
Here is an example:

Get Response Status

This method allows to directly get the [status] property of the request response.
The status is the HTTP status code associated with the response.

getResponseStatus()

This method always returns an int.

Usage example:

Get Response Headers

This method allows to get the response headers.

getResponseHeaders(bool <$array>)

This method returns a parsed associative array or a raw headers string, depending on the passed argument.

Usage examples:

Get Response Data

This method allows to directly get the [data] property of the request response.

getResponseData()

This method always returns a PHP object.

Usage example:

Get Response Messages

This method allows to directly get the [messages] property of the request response.

getResponseMessages()

This method always returns a PHP array.

Usage example:

Get Sent

This method allows to get the complete sent request.

getSent(bool <$object>)

This method returns a raw string or a PHP object, depending on the passed argument.
The sent request includes the method, endpoint, headers, and payload.

Usage examples:

Get Sent Headers

This method allows to get the sent headers.

getSentHeaders(bool <$array>)

This method returns a parsed associative array or a raw headers string, depending on the passed argument.

Usage examples:

Get Sent Payload

This method allows to get the sent payload.

getSentPayload(bool <$object>)

This method returns a raw string or a PHP object, depending on the passed argument.

Usage examples:

Get cURL Info

This method allows to get the cURL request information.
Each request is made using the PHP cURL extension, and this method returns the result of curl_getinfo().
See the official PHP.net documentation for details.

getCurlInfo()

This method always returns a PHP array.

Usage example:

Debug Start

This method allows to start the debugging mode.
Every request executed after this method call will be taken into account for the debugging.

debugStart()

This method returns the class instance itself.
For convenience, this method is chainable.

Example:

Debug Stop

This method allows to stop the debugging mode.
Every request executed after this method call will not be taken into account for the debugging.

debugStop()

This method returns the class instance itself.
For convenience, this method is chainable.

Example:

Debug Get

This method allows to get the result of the debugging data.
This method call doesn't stop the debugging mode, so it can be called every time needed.
This is just a debugging output at the time "t".

debugGet()

This method returns a PHP array.

Example:

Debug Reset

This method allows to reset the debugging data.
This method call doesn't stop the debugging mode, but it erases all collected data.

debugReset()

This method returns the class instance itself.
For convenience, this method is chainable.

Example #1:

Example #2:

Accept Unsafe Certificates

This method allows to disable the cURL SSL verify peer.
For example: accepting self-signed SSL certificates in development.

acceptUnsafeCertificatesByDisablingCurlSslVerifyPeer()

WARNING:
This method is intended for API development and testing purposes only.
It should NEVER be used when consuming production APIs, as it disables SSL verification.
Only use this when testing against local API instances with self-signed certificates.

This method returns the class instance itself.
For convenience, this method is chainable.

Example:

License

MIT


All versions of sparky-api-client-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
ext-json Version *
ext-curl Version *
ext-sodium Version *
ext-ctype Version *
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 echo-five/sparky-api-client-php contains the following files

Loading the files please wait ...