Download the PHP package mirko-pagliai/cakephp-stop-spam without Composer

On this page you can find all versions of the php package mirko-pagliai/cakephp-stop-spam. 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 cakephp-stop-spam

cakephp-stop-spam

CI codecov Codacy Badge CodeFactor

cakephp-stop-spam is a CakePHP plugin that allows you to check if a username, email address or ip address has been reported as a spammer using services and APIs offered by stopforumspam.org.

Did you like this plugin? Its development requires a lot of time for me. Please consider the possibility of making a donation: even a coffee is enough! Thank you.


Installation

You can install the plugin via composer:

Then you have to load the plugin. For more information on how to load the plugin, please refer to the Cookbook.

Simply, you can execute the shell command to enable the plugin:

This would update your application's bootstrap method.

Installation on older CakePHP and PHP versions

Recent packages and the master branch require at least CakePHP 5.0 and PHP 8.1 and the current development of the code is based on these and later versions of CakePHP and PHP. However, there are still some branches compatible with previous versions of CakePHP and PHP.

For PHP 7.2 and CakePHP 4 or later

The php7.2 branch requires at least PHP >=7.2 and CakePHP ^4.0.

In this case, you can install the package as well:

Note that the php7.2 branch will no longer be updated as of January 7, 2024, except for security patches, and it matches the 1.1.8 version.

For PHP 5.6 and CakePHP 3 or later

The cakephp3 branch requires at least PHP 5.6 and CakePHP 3.

In this case, you can install the package as well:

Note that the cakephp3 branch will no longer be updated as of May 7, 2021, except for security patches, and it matches the 1.1.3 version.

How to use

After instantiating the class, you can use email(), ip() and username() methods to specify the values to be verified and finally use the verify() method to get the result. Example:

The verify() method returns false if certainly at least one of the parameters has been reported as a spammer, otherwise returns true. In other words, the verify() method verifies that it is not a spammer.

If the API returns an error (for example if you specify an invalid ip address, or in any case if you generate a request that cannot be interpreted), an exception will be throwed.

email(), ip() and username() methods are chainable and can be called more than once, or you can pass multiple arguments. Example (the email()) method is called multiple times, while the ip() method is called with multiple arguments):

The Request detector

The plugin also adds the is('spammer') request detector. This detector checks if the user's IP address is reported as spammer. Wherever the server request is accessible, you can use the detector. An example:

The detector checks if the IP address of the user client is reported as a spammer. This happens as described above. If the IP address is not reported, the detector uses the session to store the control result.

This is very convenient and fast. It avoids repeating the code and also, using the session to memorize the result, it does not even use the cache.

How to create a validation rule

The plugin can also be used as a validation rule. Just an example:

In this case, the validator will verify that the email address has not been reported as a spammer.

For more information on how to create and use validation rules, please refer to the Cookbook.

How to configure the cache

This plugin uses the HTTP Client to make requests and get responses, which are inspected and processed one by one. This can take a lot of resources and generate a lot of network traffic. For this reason, the plugin uses the cache (except for error responses).

By default, the cache is active. You can enable or disable it using the cache option. Example:

StopSpam will use the homonymous cache engine defined in its bootstrap file.

If you want to use your own cache engine or if you want to use a different onfiguration than the default one, then you have to configure the StopSpam cache engine before loading the plugin. Example:

For more information on how to configure a cache engine, please refer to the Cookbook.

Pay particular attention to what is reported by stopforumspam.org :

This API is NOT to be used as a general software firewall. Checking every incoming connection against the API will be treated as a denial of service attack against us and will result in the immediate blocking of any offending IP addresses.

For this reason, it is advisable to use the cache, limit the requests and use the session to mark a user as already verified.

Versioning

For transparency and insight into our release cycle and to maintain backward compatibility, cakephp-stop-spam will be maintained under the Semantic Versioning guidelines.


All versions of cakephp-stop-spam with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
cakephp/cakephp Version ^5.0
mirko-pagliai/php-tools Version ~1.9.2|~1.10
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 mirko-pagliai/cakephp-stop-spam contains the following files

Loading the files please wait ....