Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

PHP HTML filtering library

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 t
Octocat-spinner-32 .gitattributes
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 README.md
Octocat-spinner-32 composer.json
Octocat-spinner-32 lib_filter.php
README.md

lib_filter

Build Status

A PHP HTML-input-filtering library. You can read about how it works in this article (part 2).

Usage

This library can be used to filter HTML directly entered by users, or recieved via a richtext editor. The library ensures that no harmful HTML will be output into the browser, avoiding all forms of XSS attacks.

include('lib_filter.php');

$safe_html = $filter->go($user_input);

echo $safe_html;

Legacy

This library has been used in many projects and frameworks, ported to other languages and used as the basis for other filtering libraries. For instance:

Testing

If you have perl's Test::Harness installed (you almost certainly do), you can run the tests using:

prove --exec 'php' t/*.t

When submitting patches or pull-requests, bonus points are given for adding test cases.

Something went wrong with that request. Please try again.