Download the PHP package restruct/silverstripe-form-obfuscator without Composer

On this page you can find all versions of the php package restruct/silverstripe-form-obfuscator. 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 silverstripe-form-obfuscator

Form obfuscator (anti-spam) for SilverStripe

Maintained by Restruct. If this module saves you time, you can support ongoing maintenance.

An HTTP middleware that automatically obfuscates all form action URLs in HTML output by replacing them with an encoded version, alternating between decimal and hexadecimal character references.

Browsers decode the references, so forms keep working unchanged. Naive spam bots that scrape action="..." out of the raw HTML get an unusable string instead of a URL to post to. It is a cheap first filter, not a replacement for a CAPTCHA or honeypot.

Example

becomes:

Requirements

Installation

Then flush (?flush=1, or sake dev/build flush=1 on Silverstripe 5, sake db:build --flush on Silverstripe 6). No further configuration is required.

Version compatibility

Branch Module version Silverstripe PHP
main 3.x ^5 \|\| ^6 ^8.1
(tags only) 2.0.x ^4 as Silverstripe 4

Silverstripe 4 reached end of life in April 2025 and is no longer supported or tested here. Projects still on it should stay on the 2.0.x tags, which remain available. 2.0.x cannot be installed on Silverstripe 5 or 6: it was built on RequestFilter, which framework 5 removed.

main is the only maintained line: it supports every Silverstripe version this module still targets, so there is no separate maintenance branch. A version branch will be created only when a change cannot be made compatible across the supported range.

composer.json is the source of truth for exact constraints; this table is a quick reference.

Upgrading from 2.x? See CHANGELOG.md.

How it works

The module registers Restruct\FormObfuscator\FormObfuscatorMiddleware as a global Director middleware (_config/extension.yml). After the rest of the stack has produced a response, the middleware rewrites every action="..." attribute in the body when:

So it applies to every HTML response the site produces - pages, the login form, any controller - not only to ContentController output.

The attribute value is decoded before it is encoded, so an action that already contains an entity (for example a query string escaped as &) still points at the same URL afterwards, and non-ASCII characters are encoded as whole characters.

Configuration

Option Default Effect
excluded_url_prefixes ['admin', 'dev'] Responses for URLs starting with one of these path segments (relative to the base URL, no leading slash) are left alone. Matched on whole segments: admin excludes admin and admin/pages, not administration.

To add a prefix:

This merges with the defaults (result: admin, dev, api). An indexed array cannot be replaced by setting it again; to replace the list, reset it to null in one fragment and set it in a later one:

To switch the middleware off for a whole project, remove it from the Director:

Public API

Limitations

Running the tests

The suite needs a booted Silverstripe project. Install the module into a host project as a symlinked path repository (/tests is export-ignore, so a dist install has no tests), then from the host root:

.github/workflows/ci.yml builds exactly such a host project per Silverstripe major.


All versions of silverstripe-form-obfuscator with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
silverstripe/framework Version ^5 || ^6
silverstripe/vendor-plugin Version ^2 || ^3
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 restruct/silverstripe-form-obfuscator contains the following files

Loading the files please wait ...