Leaf PHP util module

v1.5.0 2023-07-09 00:51 UTC

This package is auto-updated.

Last update: 2024-04-09 02:38:48 UTC



Leaf Anchor

Latest Stable Version Total Downloads License

This package contains leaf's utils for deep sanitizing of data and basic security provided for your app data. It also serves as the base for security provided in other modules like CSRF.


You can easily install Leaf using Composer.

composer require leafs/anchor

Basic Usage

After installing anchor, create an index.php file.

Base XSS protection

require __DIR__ . "vendor/autoload.php";

$data = $_POST["data"];
$data = Leaf\Anchor::sanitize($data);

echo $data;

This also works on arrays

require __DIR__ . "vendor/autoload.php";

$data = Leaf\Anchor::sanitize($_POST);

echo $data["input"];

You may quickly test this using the built-in PHP server:

php -S localhost:8000