Download the PHP package spamtroll/php-sdk without Composer

On this page you can find all versions of the php package spamtroll/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 php-sdk

Spamtroll PHP SDK

Latest Version PHP Version CI

Zero-dependency PHP client for the Spamtroll spam detection API.

Drop it into a WordPress plugin, an IPS Community Suite application, a framework app, or a plain PHP script — the core SDK has no runtime dependencies beyond ext-curl and ext-json. Host platforms can swap in their own HTTP transport (so WP calls go through wp_remote_* and respect admin filters, IPS calls go through \IPS\Http\Url) by implementing one interface.

Requirements

Installation

Without Composer (e.g. a bundled plugin), drop src/ somewhere in your project and include the fallback autoloader:

Quick start

Configuration

What the fields mean

Field Default Notes
baseUrl https://api.spamtroll.io/api/v1 Trailing slash stripped.
timeout 5 Per-request seconds (connect + read).
maxRetries 3 Total attempts, not retries. First attempt counts.
retryBaseDelayMs 500 Backoff: attempt * base ms before attempt 2+. Set 0 to disable (tests).
userAgent spamtroll-php-sdk/{version} Host integrations should prepend their own identifier.
scoreDenominator 30.0 Maps raw API score (0…∞) to normalized 0.0–1.0 via min(1, raw / denominator).

Score normalization

The backend scores on an open-ended additive scale. A raw score of 15 is "definitely spam", 30 is "twice the spam threshold". The SDK normalizes via min(1.0, raw / scoreDenominator):

Raw Normalized (denominator 30)
0 0.00
7.5 0.25
15 0.50
22.5 0.75
30+ 1.00

Use getSpamScore() for the 0–1 value and getRawSpamScore() for the raw number if you need to display the native scale.

Custom HTTP adapter

WordPress and IPS integrations ship adapters that delegate to wp_remote_* and \IPS\Http\Url respectively, so platform-level filters (proxy, SSL overrides, request inspection) still apply.

Error handling

The SDK throws when something prevents a meaningful response:

Exception When
NotConfiguredException Empty API key.
AuthenticationException HTTP 401 — invalid API key.
ConnectionException Connection failure after all retries.
TimeoutException Timeout after all retries (extends ConnectionException).
ServerException HTTP 5xx after all retries.
SpamtrollException Base for all SDK exceptions. Catch this if you want a single fail-open path.

Non-fatal error responses — HTTP 429, other 4xx — are returned as a Response with success === false and an error message, so the caller can decide whether to back off or log.

Documentation

Development

See docs/CONTRIBUTING.md for the full quality gate, including the aspell dependency required by composer peck.

License

MIT — see LICENSE.


All versions of php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
ext-curl Version *
ext-json 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 spamtroll/php-sdk contains the following files

Loading the files please wait ...