PHPackages                             humble/csrf - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. humble/csrf

ActiveLibrary[Security](/categories/security)

humble/csrf
===========

HUMBLE CSRF

011PHP

Since Oct 18Pushed 9y agoCompare

[ Source](https://github.com/humblephp/humble-csrf)[ Packagist](https://packagist.org/packages/humble/csrf)[ RSS](/packages/humble-csrf/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

humble-csrf
===========

[](#humble-csrf)

[![Latest Version](https://camo.githubusercontent.com/35877bbaf4b86b0085c7f42ca4d658233e065508016cf86bf07a6a86d88cb1c6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f68756d626c657068702f68756d626c652d637372662e737667)](https://github.com/humblephp/humble-csrf/releases)[![Software License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/29e904a9ad547023f3700d71d51f4aaed953d3cc8bee016a5c061b577f3c3e44/68747470733a2f2f6170692e7472617669732d63692e6f72672f68756d626c657068702f68756d626c652d637372662e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/humblephp/humble-csrf)

HUMBLE CSRF

- with PSR-7 CSRF Middleware

Install
-------

[](#install)

Via Composer

```
$ composer require humble/csrf
```

Usage
-----

[](#usage)

Can be use with any PSR-7 project.

Get PHP CSRF with any $storage that implements \\ArrayAccess interface.

```
$csrf = new \Humble\Csrf\Csrf($storage);

```

Use PHP CSRF with PSR-7 CSRF Middleware.

```
$middleware = new \Humble\Csrf\CsrfMiddleware($csrf);
$response = $middleware($request, $response, $next);

```

Get HTML snippet with CSRF token.

```
$snippet = $csrf->get();

```

```

```

Validate CSRF token.

```
$csrf

```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8b7f2440906b221ed621f106dca65931a0d2de3516a523782923fdf581da3f03?d=identicon)[arekwiertlewski](/maintainers/arekwiertlewski)

### Embed Badge

![Health badge](/badges/humble-csrf/health.svg)

```
[![Health](https://phpackages.com/badges/humble-csrf/health.svg)](https://phpackages.com/packages/humble-csrf)
```

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M212](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M112](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
