# symfony/security-csrf

Symfony Security Component - CSRF Library

Repository: https://github.com/symfony/security-csrf
Canonical: https://ross.abutalabs.com/products/security-csrf
Homepage: https://symfony.com/security
Language: PHP
License: MIT
License Family: permissive
Topics: php, symfony, component, symfony-component
Last push: 2026-08-03T16:43:39+00:00

## Health v2 (maintenance only)
Score: 93/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 95, release rhythm 86, longevity 100
- inputs: {"age_days": 4675, "days_push": 30, "days_rel": 96, "gap_med": 18.5, "n_releases_24m": 23}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1761, forks 8 (observed 2026-08-28T04:05:32.621699+00:00)

## What it is
The Symfony Security CSRF component provides a CsrfTokenManager class for generating and validating cross-site request forgery (CSRF) tokens in PHP applications. It is part of the Symfony framework's security ecosystem but can be used standalone.

## Use cases
- protect forms from CSRF attacks
- generate and validate CSRF tokens in PHP
- secure state-changing POST requests
- add CSRF protection to a non-Symfony PHP project
- validate tokens for AJAX form submissions

## When to choose
- you need CSRF token generation and validation in any PHP application
- you are building a Symfony app and need form security
- you want a small, well-maintained, MIT-licensed security component

## When to avoid
- you need full authentication or authorization, not just CSRF protection
- your framework already bundles CSRF protection
- you are not working in PHP

## Facets
- artifact type: library
- maturity: stable
- function: security, middleware
- domain: security, web-development, backend
- platform: php
- tags: csrf, symfony-component, token-generation, token-validation, form-protection

## Member repositories
- symfony/security-csrf (main) score 93

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:32.621699+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:27:12.769655+00:00, confidence not recorded.
  - readme: https://github.com/symfony/security-csrf (fetched 2026-08-28T04:05:32.621699+00:00, sha 99929a15de54)
  - homepage: https://symfony.com/security (fetched 2026-08-29T11:05:29.697908+00:00, sha b8a4472dada7)
  - site_page: https://symfony.com/doc (fetched 2026-08-29T11:05:29.707497+00:00, sha 44889134f4fb)
  - site_page: https://symfony.com/releases (fetched 2026-08-29T11:05:29.709473+00:00, sha 5bd749e2b676)
  - site_page: https://symfony.com/blog/category/releases (fetched 2026-08-29T11:05:29.711737+00:00, sha 0739a28df2e8)
- Data as of 2026-08-30T08:39:29.467469+00:00.
