PHPackages                             ympervej/wp-oop-nonces-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ympervej/wp-oop-nonces-csrf

ActiveWordpress-package[Utility &amp; Helpers](/categories/utility)

ympervej/wp-oop-nonces-csrf
===========================

This package enables the wordpress nonce function in an object-oriented environment

1.0.0(8y ago)010PHPPHP &gt;=5.6.0

Since Jan 19Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Yeasir/wp-oop-nonces-csrf)[ Packagist](https://packagist.org/packages/ympervej/wp-oop-nonces-csrf)[ RSS](/packages/ympervej-wp-oop-nonces-csrf/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

\#WordPress Nonces in OOP Environment

A composer package, which serves the functionality working with WordPress Nonces in an object orientated environment.

\#Requirement

```
Wordpress Version: Minimum 4.8
PHP Version: Minimum 5.6
PHP Unit Version: 5
```

\#Installation Add this package as requirement at your composer.json file and then run 'composer update'

```
"ympervej/wp-oop-nonces-csrf": "1.0.*"
```

Or directly run

```
composer require ympervej/wp-oop-nonces-csrf
```

\##Usage

add to your functions.php, in the active theme

```
// Autoload files using Composer autoload
require __DIR__ . '/vendor/autoload.php';
```

\##Examples

\###Create a nonce

##### This will creates a cryptographic token tied to a specific action

[](#this-will-creates-a-cryptographic-token-tied-to-a-specific-action)

\####### Arguments string or int $action Scalar value to add context to the nonce. ####### Return The token.

```
$Wp_Csrf_Nonce = new \wp_oop_nonce_csrf\Wp_Oop_Nonces_Csrf();
$csrf_nonce_create = $Wp_Csrf_Nonce->wp_oop_create_nonce( $action );
```

For example:

```
