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 3w 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 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

1806d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/36641723?v=4)[Ahmet Barut](/maintainers/ahmetbarut)[@ahmetbarut](https://github.com/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

[mews/purifier

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

2.0k18.7M142](/packages/mews-purifier)[paragonie/ecc

PHP Elliptic Curve Cryptography library

24820.0k37](/packages/paragonie-ecc)

PHPackages © 2026

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