Download the PHP package gsteel/akismet without Composer

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

Akismet Client Library

Continuous Integration Psalm Type Coverage Latest Stable Version Total Downloads

Introduction

Provides a straight-forward way of using the Akismet anti-spam service in any-old PHP application.

Installation & Requirements

Requires PHP ~8.0 || ~8.1 || ~8.2

The library does not include an HTTP client, so if your project does not already have a PSR-18 HTTP Client installed, you will need to install one in order to use it. There are many HTTP clients to choose from, for example the popular libraries Guzzle or HttpPlug.

The library also requires that you have a PSR-17 (HTTP Factories) library installed, again, you can find implementations on Packagist and I personally favour laminas/laminas-diactoros.

Basic Usage

Construct a client

Once you have the requisite HTTP related libraries installed, they should become discoverable with the shipped discovery library. Provide an Api key, and the default website address that you will be operating with to the constructor, and you’ll have a ready-to-use client:

Comment Parameters & Checking Content

The primary concern of the library is to check requests such as comments and form submissions to ascertain whether the content is "Spam" or "Ham".

The Akismet API has a number of parameters available to improve the accuracy of the check which have been encapsulated into an immutable value object \Gsteel\Akismet\CommentParameters.

If you are familiar with the parameter names, you can pass in an array to the constructor of this object, otherwise you can call various methods to build an object to include all the information you wish to provide.

There are a considerable number of additional arguments and methods available that can be used to provide as much context as possible to the API, there is also a named constructor that is useful in an environment that utilises PSR-7 Messages:

Submitting False Positives or False Negatives

Submitting content that was incorrectly classified as Spam can be achieved by sending the same payload used in check() to the method submitHam(). Conversely, you can submit incorrectly classified Ham as actual Spam with submitSpam():

You can serialise and un-serialise a Result from the clients check() method to a JSON string:

Coupled with your own method of identifying a specific request, you could create a mechanism to store the result in order to submit it as ham or spam based on user feedback.

Error Handling

All errors implement \GSteel\Akismet\GenericException so it is possible to catch any errors thrown by the library with a single type. Notable concrete exceptions include:

PSR-11 Containers

A factory is shipped in \GSteel\Akismet\Container\ClientDiscoveryFactory that can be wired up in your DI container of choice that leverages Http Discovery to inject Http clients and factories etc.

It assumes that the container will return an array or something implementing ArrayAccess by asking for config It further assumes that this configuration structure contains the following information:

License

Released under the MIT License - see the LICENSE file for details


All versions of akismet with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1 || ~8.2 || ~8.3
ext-json Version *
myclabs/php-enum Version ^1.8.3
php-http/discovery Version ^1.14.1
psr/container Version ^1.0 || ^2.0
psr/http-client Version ^1.0.1
psr/http-client-implementation Version *
psr/http-factory Version ^1.0.1
psr/http-factory-implementation Version *
webmozart/assert Version ^1.11
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 gsteel/akismet contains the following files

Loading the files please wait ....