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

ActiveLibrary[Security](/categories/security)

ahmetbarut/csrf
===============

v1.0.1(4y ago)17GPL-3PHP

Since Jul 23Pushed 4y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (5)Used By (0)

PHP CSRF
========

[](#php-csrf)

Kurulum
-------

[](#kurulum)

```
    composer require ahmetbarut\Csrf
```

### Basit Kullanım

[](#basit-kullanım)

`vendor/autoload.php` dosyasını dahil ettikten sonra `Csrf` sınıfını üretin. Sınıfı `new` anahtar kelimesiyle çağırdığınızda token üretecektir. Tokeni kullanmak için:

```
    use ahmetbarut\Csrf\Csrf;

    require __DIR__ . "/vendor/autoload.php";

    // Sınıfı ürettiğinizde token oluşturur. Herhangi bir istek yoksa üretilir, istek varsa token üretmez.
    $csrf = new Csrf;

    // Üretilen token değerini getirir.
    $csrf->getToken();
```

### HTML İçinde Kullanım Ve Kontrol

[](#html-i̇çinde-kullanım-ve-kontrol)

Burda kolay kullanım açısından form içinde helper fonksiyonları kullanılıyor. İki yöntemi de kullanabilirsiniz.

! Not :
-------

[](#-not-)

`hasToken` yöntemine gelen verileri olduğu gibi veriniz arkaplanda, `input[name=_token]` olarak bakacaktır.

```

    Gönder

```

MethodHakkında\_\_constructNesne üretildiğinde beraberinde `session`'u başlatır ve token oluşturur.tokenHasVerilen tokeni, oluşturulan token ile karşılaştırır.getTokenOluşturulan son tokeni döndürür.csrf\_fieldİnput oluşturur ve token verir. Helper fonksiyonudur.create\_tokenYeni token oluşturur.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~0 days

Total

2

Last Release

1760d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/530008a3a5e32fa689343dc342c6686b50267ba86905e55e5f42ad2d1c8c193c?d=identicon)[ahmetbarut](/maintainers/ahmetbarut)

---

Top Contributors

[![ahmetbarut](https://avatars.githubusercontent.com/u/36641723?v=4)](https://github.com/ahmetbarut "ahmetbarut (11 commits)")

---

Tags

csrf-tokencsrf-tokensphp-csrf

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/ahmetbarut-csrf/health.svg)](https://phpackages.com/packages/ahmetbarut-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)[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)
