PHPackages                             abdelhammied/api-csrf-protection - 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. abdelhammied/api-csrf-protection

ActiveLibrary[Security](/categories/security)

abdelhammied/api-csrf-protection
================================

This Package is used to secure apis from any cross sites request forgery while wroking with mobile applications using rsa assemetric key

11PHP

Since Jun 6Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Abdelhammied/Api-Csrf-Protection)[ Packagist](https://packagist.org/packages/abdelhammied/api-csrf-protection)[ RSS](/packages/abdelhammied-api-csrf-protection/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

Api-Csrf-Protection
===================

[](#api-csrf-protection)

This Package is used to secure apis from any cross sites request forgery while wroking with mobile applications using rsa assemetric key with two ways authentication with your mobile team / any one who wants to interact with your apis

**This Package uses phpseclib/phpseclib**

Installation
------------

[](#installation)

```
composer require abdelhammied/api-csrf-protection

```

Configuration
-------------

[](#configuration)

We Are Setting Every Thing To You We Only Need Your Support And Have Fun With Our Package

Usage
-----

[](#usage)

1. Create Public and private keys using `php artisan createencrytionkeys` This will create public key and private keys at `storage/app/keys`, share the public keys with your mobile team.
2. Start to define the middleware as route middleware at `app/Http/Kernel.php` using this middleware `\ApiCsrfProtection\Middlewares\VerifyApiToken::class`
3. You can define which apis to be secured with the package `should be Not GET method`
4. from the mobile team side start to create a random string with each not GET request, use the public key to hash the string after that use base64\_encode with the hased value, send the data with the request like:

```
{
  "__token": {
    "plainText": "$RANDOM_STRING",
    "cipherText": "$HASHED_VALUE"
  }
}
```

### For Any Inquires please contact us :

[](#for-any-inquires-please-contact-us-)

`abdelhammied@gmail.com`

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/35538743?v=4)[Abdelhammied Elsayed](/maintainers/Abdelhammied)[@Abdelhammied](https://github.com/Abdelhammied)

---

Top Contributors

[![Abdelhammied](https://avatars.githubusercontent.com/u/35538743?v=4)](https://github.com/Abdelhammied "Abdelhammied (19 commits)")

### Embed Badge

![Health badge](/badges/abdelhammied-api-csrf-protection/health.svg)

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

###  Alternatives

[mews/purifier

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

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

PHP Elliptic Curve Cryptography library

24820.0k39](/packages/paragonie-ecc)

PHPackages © 2026

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