PHPackages                             radix/nonce-oop - 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. radix/nonce-oop

ActiveLibrary[Security](/categories/security)

radix/nonce-oop
===============

Wordpress Nonce OOP

1.0(7y ago)06MITPHPPHP &gt;=7.0

Since Jan 27Pushed 7y agoCompare

[ Source](https://github.com/radixs/nonce-oop)[ Packagist](https://packagist.org/packages/radix/nonce-oop)[ Docs](https://github.com/radixs/nonce-oop)[ RSS](/packages/radix-nonce-oop/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (4)Dependencies (1)Versions (6)Used By (0)

NonceOop
========

[](#nonceoop)

This is an oop wrapper for wordpress nonces functionality.

Installation
============

[](#installation)

If you have not done that already add composer autoloader to your wordpress main index.php:

```
require_once('vendor/autoload.php');

```

Add to your `composer.json` in `require` this: `"radix/nonce-oop": "1.0` and run `composer update`.

Usage
=====

[](#usage)

### Initialize the facade.

[](#initialize-the-facade)

At the beginning of the file you want to use nonces in put:

```
use radix\NonceOop\NonceFacade;

```

then you can instantiate a common facade via:

```
$facade = new NonceFacade('testAction');

```

Without a second argument it will use the default `SimpleNonce` variant. If you want you can also use `RequestNonce` and `AjaxNonce`, just add them to the `use` declaration and inject their insances into the facade like that:

```
use radix\NonceOop\{NonceFacade, RequestNonce};

// ...

$facade = new NonceFacade('testAction', new RequestNonce());

```

### Use the interface.

[](#use-the-interface)

After that is done you have four methods that you can use:

```
$simpleNonce  = $facade->create();
$fieldNonce   = $facade->createField();
$urlNonce     = $facade->createUrl('http://example.com');
$isNonceValid = $facade->check($simpleNonce);

```

The methods wrap original WordPress nonce functions.

- create method creates a simple 10-character string,
- createField method gives you HTML string containing hidden input field with a nonce in it. Refer to the method interface to see what options you can use.
- createUrl method gives you an URL with a nonce appended to URL's query. Refer to the method interface to see what options you can use.
- check method validates the nonce. When used with `SimpleNonce` it only checks the string, other classes check the $\_REQUEST superglobal.

Extending
=========

[](#extending)

You can add your own class that implements `NonceServiceInterface` and inject it into the facade on initialization.

Tests
=====

[](#tests)

In order to run tests type:

```
vendor/bin/phpunit --bootstrap vendor/autoload.php vendor/radix/nonce-oop/tests/src

```

Please note that you need to have PHPUnit installed.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

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

Total

4

Last Release

2661d ago

Major Versions

0.2 → 1.02019-01-30

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8850714?v=4)[Radoslaw Kurowski](/maintainers/radixs)[@radixs](https://github.com/radixs)

---

Top Contributors

[![radixs](https://avatars.githubusercontent.com/u/8850714?v=4)](https://github.com/radixs "radixs (28 commits)")

---

Tags

wordpressnonce

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/radix-nonce-oop/health.svg)

```
[![Health](https://phpackages.com/badges/radix-nonce-oop/health.svg)](https://phpackages.com/packages/radix-nonce-oop)
```

###  Alternatives

[mikemclin/laravel-wp-password

Laravel package that checks and creates WordPress password hashes

863.4M2](/packages/mikemclin-laravel-wp-password)[brain/nonces

OOP package for WordPress to deal with nonces.

26227.1k1](/packages/brain-nonces)[wp-privacy/wp-api-privacy

Strips potentially identifying information from outbound requests to the WordPress.org API

1632.0k](/packages/wp-privacy-wp-api-privacy)

PHPackages © 2026

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