PHPackages                             cradlephp/cradle-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. cradlephp/cradle-csrf

ActiveCradle-package[Security](/categories/security)

cradlephp/cradle-csrf
=====================

CSRF handler for Cradle

2.3.0(5y ago)092811MITPHP

Since Mar 12Pushed 5y ago1 watchersCompare

[ Source](https://github.com/CradlePHP/cradle-csrf)[ Packagist](https://packagist.org/packages/cradlephp/cradle-csrf)[ RSS](/packages/cradlephp-cradle-csrf/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (6)Dependencies (4)Versions (10)Used By (1)

cradle-csrf
===========

[](#cradle-csrf)

CSRF helpers

Install
-------

[](#install)

```
composer require cradlephp/cradle-csrf

```

Then in `/bootstrap.php`, add

```
->register('cradlephp/cradle-csrf')

```

Usage
-----

[](#usage)

In any of your routes add the following code.

```
cradle()->trigger('csrf-load', $request, $response);

```

The CSRF token will be found in `$request->getStage('csrf')`. In your form template, be sure to add this key in a hidden field like the following.

```

```

When validating this form in a route you can use the following

```
cradle()->trigger('csrf-validate', $request, $response);

```

If there is an error, it will be found in the response error object message. You can check this using the following.

```
if($response->isError()) {
    $message = $response->getMessage();
    //report the error
}

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity69

Established project with proven stability

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.

###  Release Activity

Cadence

Every ~104 days

Recently: every ~131 days

Total

9

Last Release

2155d ago

Major Versions

0.0.4 → 2.1.x-dev2018-10-10

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/120378?v=4)[Christian Blanquera](/maintainers/cblanquera)[@cblanquera](https://github.com/cblanquera)

---

Tags

cradlecradle-csrfcradlephpcsrfv1v2cradlecradlephp

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/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.7M113](/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)[illuminate/encryption

The Illuminate Encryption package.

9229.7M280](/packages/illuminate-encryption)

PHPackages © 2026

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