• Stars
    star
    125
  • Rank 286,335 (Top 6 %)
  • Language
    PHP
  • Created almost 13 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A PHP class that enables you use the Akismet anti-spam service in your PHP5 application.

Introduction

This is a simple little PHP5 class that enables you use the Akismet anti-spam service in your PHP5 application.

Download

Check out the git repository:

git clone [email protected]:achingbrain/php5-akismet.git

Installation

Once you have cloned the repo (see Download, above) copy the file at src/main/php/net/achingbrain/Akismet.class.php to somewhere accessible to your scripts. Use include or a derivative to import it into your script.

Alternatively if you are running a version of PHP greater than 5.3, grab the phar file and use the following code:

<?php
	include 'phar:///path/to/php5-akismet-0.5.phar/net/achingbrain/Akismet.class.php';
?>

Documentation

See the PHPDocs.

Usage

Before you can use Akismet, you need a WordPress API key (they are free and getting one takes about five minutes). Once you have one, take a look at the code below:

$WordPressAPIKey = 'aoeu1aoue';
$MyBlogURL = 'http://www.example.com/blog/';

$akismet = new Akismet($MyBlogURL ,$WordPressAPIKey);
$akismet->setCommentAuthor($name);
$akismet->setCommentAuthorEmail($email);
$akismet->setCommentAuthorURL($url);
$akismet->setCommentContent($comment);
$akismet->setPermalink('http://www.example.com/blog/alex/someurl/');

if($akismet->isCommentSpam())
  // store the comment but mark it as spam (in case of a mis-diagnosis)
else
  // store the comment normally

That's just about it. In the event that the filter wrongly tags messages, you can at a later date create a new object and populate it from your database, overriding fields where necessary and then use the following two methods to train it:

$akismet->submitSpam();

and

$akismet->submitHam();

to submit mis-diagnosed spam and ham, which improves the system for everybody. See the included documentation for a complete run-down of all available methods.

Changelog

Version 0.5

  • Deployed to GitHub instead of achingbrain.net for better collaboration in future
  • Converted project to use Maven for unit testing and documentation generation
  • Unit tests & documentaiton
  • Allowed overriding of user agent when submitting ham/spam (thanks Steven)

Version 0.4

  • Performance – changed HTTP version from 1.1 to 1.0 (with thanks to Jan De Poorter).
  • Performance – No longer issues a separate HTTP request to check validity of the API key with every instantiation.
  • Added a new public method 'isKeyValid' to manually check validity of the API key passed to the constructor.
  • The method 'isCommentSpam' (rather than the constructor) will now throw an exception if the API key is invalid.
  • Tidied up internal structure a bit.

Version 0.3

Internal testing version

Version 0.2

Initial release

Version 0.1

Internal testing version

More Repositories

1

pm2-web

A web based monitor for PM2
JavaScript
530
star
2

it

A collection of utilities for making working with iterables more bearable
TypeScript
271
star
3

mongoose-crate

A Mongoose plugin for attaching files to documents.
JavaScript
57
star
4

ssdp

Simple Service Discovery Protocol implemented for Node.js
TypeScript
45
star
5

uint8arrays

Utility methods for dealing with Uint8Arrays
TypeScript
37
star
6

board-io

Allows for boards other than Arduinos loaded with Firmata to be used with johnny-five
JavaScript
22
star
7

mongoose-crate-s3

JavaScript
17
star
8

build-cat

Physical build avatar
JavaScript
14
star
9

mongoose-crate-imagemagick

JavaScript
10
star
10

node-wantsit

Super lightweight dependency injection
JavaScript
9
star
11

jvm.js

A JVM implemented in JavaScript
JavaScript
7
star
12

cpu-stats

Calculates per-core CPU usage of the current computer
JavaScript
7
star
13

less-maven-plugin

Another LESS plugin for Maven
JavaScript
7
star
14

it-multipart

Async iterable http multipart message parser
JavaScript
5
star
15

it-all

Collects all values from an async iterator and returns them as an array
JavaScript
5
star
16

swagger-ui-browserify

Use swagger-ui with browserify
JavaScript
4
star
17

native-fetch

Returns native fetch if available or the node-fetch module if not
JavaScript
4
star
18

mortice

Isomorphic read/write lock that works in single processes, node clusters and web workers
TypeScript
4
star
19

homebridge-esp8266-rf-outlet

Homebridge plugin for RF outlets
C++
4
star
20

esm-vs-cjs

JavaScript
4
star
21

uint8arraylist

Append and consume bytes using only no-copy operations
TypeScript
4
star
22

coercer

Turns objects/arrays full of strings of numbers and booleans into primitives
JavaScript
3
star
23

mongoose-crate-gm

JavaScript
3
star
24

it-last

Returns the last result from an async iterator
JavaScript
3
star
25

bonvoyage

Seaport service discovery and registering via mDNS/Bonjour/zeroconf
JavaScript
3
star
26

bbq

Javascript Ninjery
JavaScript
3
star
27

it-flat-batch

Takes an async iterator that emits variable length arrays and emits them as fixed size batches
JavaScript
3
star
28

mongoose-crate-localfs

JavaScript
3
star
29

it-buffer-stream

An async iterator that emits buffers containing bytes up to a certain length
JavaScript
3
star
30

it-first

Returns the first result from an async iterator
JavaScript
3
star
31

it-stream-types

Typescript types for AsyncIterable sink/source/duplex streams
TypeScript
2
star
32

docker-ipfs-pubsub

JavaScript
2
star
33

ioboard-beaglebone-black

An implementation of ioboard for the BeagleBone Black
JavaScript
2
star
34

footballbot

JavaScript
2
star
35

coveralls-lerna

Collates coverage data generated by monorepos and sends it to coveralls
JavaScript
2
star
36

async-iterator-to-buffer

When passed an async iterator that returns buffers, cat them all together
2
star
37

mongoose-crate-gcs

JavaScript
2
star
38

nano-repository

Simple CRUD wrapper for nano and CouchDB
JavaScript
2
star
39

it-glob

Async iterable filename pattern matcher
JavaScript
2
star
40

brickpi

Node.js bindings for the BrickPi
JavaScript
2
star
41

SimpleHTTPd

Extremely lightweight embedded Cocoa web server
2
star
42

hexify

Turn files into arrays of hex codes
JavaScript
2
star
43

native-abort-controller

Returns native AbortController/AbortSignal if available or the abort-controller module if not
JavaScript
2
star
44

readable-stream-buffer-stream

A readable stream that emits buffers containing bytes up to a certain length
JavaScript
2
star
45

pem-promise

The pem module wrapped in a promises API
JavaScript
1
star
46

wherearewe

Environment detection
JavaScript
1
star
47

node-maestro-ioboard

Pololu Maestro implementation of ioboard
JavaScript
1
star
48

progress-events

Progress events and types
TypeScript
1
star
49

bigboard

BBQjs based ticket/milestone interrogation system
JavaScript
1
star
50

ipfs-unixfs-cli

Simple cli tool to inspect UnixFS metadata from IPFS DAG nodes
JavaScript
1
star
51

dht-delegate-example

Publish non-dag-pb data on the DHT from js-IPFS using a go-IPFS DHT delegate
JavaScript
1
star
52

freeport-promise

A promise to find a free port
TypeScript
1
star
53

puppeteer-frames

JavaScript
1
star
54

mono-repo-bootstrap

A starting point for mono-repo projects
1
star
55

barbara-ngrok

Create an ngrok tunnel to this computer and tweet at me when it's done
JavaScript
1
star
56

nss

Precompiled nss tools
JavaScript
1
star
57

nodebots-of-london-tutorials

Beginner tutorials for NodeBots of London
JavaScript
1
star
58

clockbot

Giant LED clock controller
JavaScript
1
star
59

maven-repo

Maven repository for my various weekend warrior projects
JavaScript
1
star
60

meatmon

Smoking me some brisket
JavaScript
1
star
61

pull-buffer-stream

Emits streams of buffers
JavaScript
1
star
62

munitorum

JavaScript
1
star
63

node-firmata-ioboard

Firmata implementation of ioboard
JavaScript
1
star
64

it-parallel-batch

Takes an async iterator that emits promise-returning functions, invokes them in parallel and emits the results in the same order as the input
JavaScript
1
star
65

output-buffer

Buffers your outputs and calls a function when a linebreak is found
TypeScript
1
star
66

electron-chromedriver

Docker images with electron-chromedriver and a VNC server installed for integration testing your Electron apps
Shell
1
star
67

electron-adventure

A self-guided workshop for learning electron
JavaScript
1
star
68

swagger-ui-browserify-example-v2.0

An example of how to use swagger-ui-browserify with Swagger v2.0 compliant APIs
JavaScript
1
star
69

flex-multi-module-sample

A demo app showing flex-mojos not minding what the parent pom is
ActionScript
1
star
70

wss-demo

Shell
1
star