Delivering the best Add-Ons in more than 37 languages.

中文(简体), English, हिन्दी/हिंदी, Español/Castellano, العربية, Русский язык, Français, 中文 (台灣), বাংলা, Bahasa Indonesia, اردو, Português, Deutsch, Bahasa Melayu (بهاس ملايو‎), 日本語 (にほんご), فارسی, Italiano, తెలుగు, Türkçe, ગુજરાતી, Język polski/polszczyzna, Tiếng Việt, ಕನ್ನಡ, Українська мова, ไทย
PHP Scripts / Miscellaneous

PHP Key Generation and Authentication Class

— Add-On to

Subscribe to our feed to stay up to date!

New! Follow us as you want it!

PHP Key Generation and Authentication Class - CodeCanyon Item for Sale


Ad: Bluehost hosting

Create, store, and authenticate generated keys with this easy to use class.


  • Customizable key pattern
    • Add a Prefix and/or Suffix to your keys.
    • Define key length with two variables, length of each chunk, and number of chunks in each key.
    • Change the chunk separator, default of ”-” works well but maybe you want a seamless key.
  • MySQL based key storage
    • Store, Activate, and Deactivate Keys via the database or included class functions.
  • Time sensitive keys
    • Set a key to expire in one minute, or 10 years, its up to you.
  • One time use keys
    • User validation.
    • One time use promotion keys.
  • KeyMatch system for an extra layer of authentication.
    • Store the clients email, username, domain, server ip, possibilities are endless.
  • An easy to use API.
    • Integrate authentication into any programming language.
    • Use for scripts, desktop applications, mobile applications, etc.

Flow Chart

Deploy this in your own products to ensure they are only used by whom has the right.

Ensure your product is not stolen with this easy to use system. Integrate the generation system in with your billing software and supply your customers with an authentication key. With this they can authenticate there script or software via the net. Key authentication does not require the Keyauth PHP Class, so you can deploy the keys on any platform or scripting language.

With the addition of a match string as a second level of security, the end-user would be required to supply a valid key along with the corresponding match key. This match key could be the domain or IP address of the server where the script lives. With this, you can ensure its used only on a single server, by a single user.


With just a few lines of code, you can create a fully unique key.
include("keyauth.class.php"); $keyauth = new Keyauth; $keyauth->key_unique = TRUE; $keyauth->key_store = TRUE; $key = $keyauth->generate_key(); echo $key;

This is how easy it is to implement client side.

$key = "81I3-MD1F-DJRL-5D6N-9551"; $auth_url = "{$key}"; $data = file_get_contents(); $result = json_decode($result); if($result['valid']!= true){ die("Invalid Key. Script Stopped!") }

Please note, these are very crude examples and are kept small for the sake of this page. Much more can be accomplished in a real environment.


If you purchased the class before the latest update date below, visit your downloads section and download the newest version.
  • June 24th, 2010
    • Added Key Activation and Deactivation
    • Added One Time Use Keys
  • June 20th, 2010
    • Item listed on CodeCanyon

Coming Soon

  • Extend Expire Date

Other components in this categoryAll components of this author
CommentsFrequently asked questions and answers


21 June 10

Last Update:

Software Version:
PHP 4.x, PHP 5.x, PHP 5.0 - 5.2, PHP 5.3, MySQL 4.x, MySQL 5.x, jQuery

Files Included:


eCommerce, All Items, authentication, client, generator, key, keygen, licensing, protection, serial, user