PHPackages                             media-store-net/wp-oop-nonces - 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. media-store-net/wp-oop-nonces

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

media-store-net/wp-oop-nonces
=============================

A simple Way to handle nonces in your plugin or theme on a OOP environment

04PHPCI failing

Since Dec 4Pushed 6y ago1 watchersCompare

[ Source](https://github.com/media-store-net/wpnonces)[ Packagist](https://packagist.org/packages/media-store-net/wp-oop-nonces)[ RSS](/packages/media-store-net-wp-oop-nonces/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

WpNonces README
===============

[](#wpnonces-readme)

Description
-----------

[](#description)

By developing WordPress Plugins and Themes sometimes you need store your own Project-Settings into the wp\_options table. This Tool make it easier to handle the wp\_nonce\_\* functions in a OOP-environment.

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

[](#installation)

Easiest way to install is using composer,

composer require media-store-net/wp-oop-nonces

or clone this Repo with

`git clone https://github.com/media-store-net/wpnonces.git`

How to use
----------

[](#how-to-use)

In general, you can use this class without further adjustment.

As an example I have created a plugin, where i will use this package to handle nonce.

*Step 1 :* require the autoload.php to make it accessible in your plugin/theme | can be emited by using composer

- download the Repo and store it in vendor folder in your plugin

`require_once WP_PLUGIN_DIR . '/' . plugin_basename( __DIR__ ) . '/vendor/WpNonces/vendor/autoload.php';`*Step 2 :* load an instance in your settings or options page

`$wp_nonces = \MediaStoreNet\WpNonces\WpNonces::getInstance();`
**this static method allows you to use allways the same instance of the class
in all your settings/options files.**

*Step 3:* create a form In my case i do this on a separate function and call these in my settings/options page

``

```

    Input

```

``

*Step 4:* Validate

to validate you have several options

call **$wp\_nonce-&gt;verify('nonceString')**

`if ( $wp_nonces->verifyNonce($_REQUEST['_wpnonce']) ): //store options...; endif;`

call **$wp\_nonce-&gt;verifyAdmin()**

`if ( $wp_nonces->verifyAdmin() ): // store options...; endif;`

call **$wp\_nonces-&gt;verifyAjax()** to validate Ajax Requests

`if ( $wp_nonces->verifyAjax() ): //store ajax request options...; endif;`

By default is used fieldName of nonce "\_wpnonce" like in WordPress use. The action string is "wp-oop-nonce"

For more secure and customized nonce you can modify the fieldName and Action string too

`$wp_nonces->setFieldName('my-custom-name'); $wp_nonces->setAction('my-custom-action');`

When needed you can also use more then one instance like this

`$nonces1 = new MediaStoreNet\WpNonces\WpNonces(); $nonces1->setFieldName('name1'); $nonces1->setAction('action1');`

`$nonces2 = new MediaStoreNet\WpNonces\WpNonces(); $nonces2->setFieldName('name2'); $nonces2->setAction('action2');`

To see all available propertys and methods, please visit our [API Documentation Site](http://wpnonces.docs.media-store.net/)

Minimum Requirements / Dependencies
-----------------------------------

[](#minimum-requirements--dependencies)

- PHP ^7.0
- WordPress latest-2

When installed for development, via Composer requires:

- phpunit/phpunit (BSD-3-Clause)
- brain/monkey (MIT)
- inpsyde/php-coding-standards

Documentation
-------------

[](#documentation)

**Please visit our Documentation Site**[API Documentation Site](http://wpnonces.docs.media-store.net/)

CHANGELOG
---------

[](#changelog)

[Link to changelog](CHANGELOG.md)

Licence and Copyright
---------------------

[](#licence-and-copyright)

GPLv2+ Licence

Copyright (c) 2019 Media-Store.net

###  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/3de5bd4b6e0c6349b9fd6b393336cf7b7065167dc87b5597821a09dedf9b9399?d=identicon)[media-store-net](/maintainers/media-store-net)

---

Top Contributors

[![media-store-net](https://avatars.githubusercontent.com/u/20956285?v=4)](https://github.com/media-store-net "media-store-net (1 commits)")

### Embed Badge

![Health badge](/badges/media-store-net-wp-oop-nonces/health.svg)

```
[![Health](https://phpackages.com/badges/media-store-net-wp-oop-nonces/health.svg)](https://phpackages.com/packages/media-store-net-wp-oop-nonces)
```

###  Alternatives

[emil/inliner

1911.3k1](/packages/emil-inliner)[flowpack/nodegenerator

Random nodes generator for Neos CMS

122.1k](/packages/flowpack-nodegenerator)[haariga/craft-gonzo

Component Library from your templates Folder

121.7k](/packages/haariga-craft-gonzo)[bigelephant/string

A string helper task with built in classes to easily add to Laravel 4

121.7k](/packages/bigelephant-string)

PHPackages © 2026

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