PHPackages                             kamalyon/wp-nonce - 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. kamalyon/wp-nonce

ActiveWordpress-plugin

kamalyon/wp-nonce
=================

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

110PHP

Since Jan 29Pushed 10y ago1 watchersCompare

[ Source](https://github.com/kamalyon/wp-nonce)[ Packagist](https://packagist.org/packages/kamalyon/wp-nonce)[ RSS](/packages/kamalyon-wp-nonce/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

wp-nonce
========

[](#wp-nonce)

WordPress plugin that enables the wordpress nonce function in an object-oriented environment.

\##How to install

Add to your composer.json file this package as a require an then run 'composer update'

```
"kamalyon/wp-nonce": "1.0.*"

```

Or directly run

```
composer require kamalyon/wp-nonce

```

\##How to use

Create nonce

```
$Wp_Nonce = new Wp_Nonce();
$nonce = $Wp_Nonce->createNonce('my-nonce');
```

Prints nonce input field

```
$Wp_Nonce = new Wp_Nonce();
$Wp_Nonce->nonceField('name-of-my-action', 'name-of-nonce-field');
```

Create nonce url

```
$Wp_Nonce = new Wp_Nonce();
$url = $Wp_Nonce->nonceURL('http://my-url.com', 'doing-something', 'my-nonce');
```

Verify nonce

```
$nonce = $_REQUEST['nonce'];
$Wp_Nonce = new Wp_Nonce();
if ($Wp_Nonce->verifyNonce($nonce, 'my-nonce')) {
    //OK
}else{
    //KO
}
```

Check admin referer

```
$Wp_Nonce = new Wp_Nonce();
if ($Wp_Nonce->checkAdminReferer('name-of-my-action', 'name-of-nonce-field')) {
   //OK
}else{
   //KO
}
```

\##How to run Unit Tests

1. Install WordPress developer suite

```
// Make the directory for the tools (assumes that ~/svn exists;
// you can create it by running "$ mkdir ~/svn")
$ mkdir ~/svn/wordpress-dev

// Change to the new directory we just made.
$ cd ~/svn/wordpress-dev

// Check out the developer tools with SVN.
$ svn co http://develop.svn.wordpress.org/trunk/

```

2. Check the WordPress developer suite is working properly

```
// Change to the trunk directory.
$ cd ~/svn/wordpress-dev/trunk/

// Make sure the checkout is up to date.
$ svn up

// Run all of the tests.
$ phpunit

// Run only, e.g., the cache tests.
$ phpunit tests/phpunit/tests/cache

```

3. Install this plugin

```
composer require kamalyon/wp-nonce

```

4. Change the paths in the bootstrap.php file of the plugin

```
// The path to the WordPress tests checkout.
define( 'WP_TESTS_DIR', '/Users/me/workspace/wordpress-dev/trunk/tests/phpunit/' );
// The path to the main file of the plugin to test.
define( 'TEST_PLUGIN_FILE', '/Users/me/workspace/wp-nonce/wp-nonce.php' );

```

5. Run the unit tests

```
// Go to the plugin's folder
cd /Users/me/workspace/wp-nonce/
// Run the tests
phpunit

```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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/74d9335511bbfa20ee56f1b79e558187eb992dfa260ee026f51018755c05a730?d=identicon)[kamalyon](/maintainers/kamalyon)

---

Top Contributors

[![albertocm](https://avatars.githubusercontent.com/u/298938?v=4)](https://github.com/albertocm "albertocm (6 commits)")[![kamalyon](https://avatars.githubusercontent.com/u/16883522?v=4)](https://github.com/kamalyon "kamalyon (1 commits)")

### Embed Badge

![Health badge](/badges/kamalyon-wp-nonce/health.svg)

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

PHPackages © 2026

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