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 1mo ago

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

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

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://www.gravatar.com/avatar/3578e02fc8cc2505962b4f666d929e54d616f1d90f44c8305ca21c0d0f35bcee?d=identicon)[Abdelhammied](/maintainers/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

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M212](/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.7M112](/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)
