PHP Classes

PHP API Key Generator: A random API key generator to server as access restriction to AP

Recommend this page to a friend!
  All requests RSS feed  >  PHP API Key Generator  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

PHP API Key Generator

Edit

Picture of mzer terungwa by mzer terungwa - 7 years ago (2017-02-11)

A random API key generator to server as access restriction to AP

This request is clear and relevant.
This request is not clear or is not relevant.

+6

I have created a restful API for a hosted service. To restrict indiscriminate access to the API, each client must submit an API key to be authenticated. I need a nice PHP class for this if any.

Ask clarification

3 Recommendations

PHP GUID Generator: Generate a globally unique identifier string

This recommendation solves the problem.
This recommendation does not solve the problem.

0

Picture of John Conde by John Conde package author package author Reputation 75 - 3 years ago (2020-06-17) Comment

The GUID Generator class creates a globally unique identifier that is ideal for API keys. GUIDs, also known ad UUIDs (Universally Unique IDs) are used in enterprise applications to provide a virtually guaranteed unique identifier for your users, as database keys, component identifiers, or just about anywhere else a unique identifier is required.

IDs are so unique that if everyone in the world generated 600,000,000 GUIDs there is a 50% chance that ONE key will be duplicated.


Riddler: Generate passwords according to given criteria

This recommendation solves the problem.
This recommendation does not solve the problem.

0

Picture of DeGraciaMathieu by DeGraciaMathieu package author package author Reputation 75 - 6 years ago (2018-02-06) Comment

Hello, You can create random token with this package

  • 1 Comment
  • 3. Picture of Felicia Kelley by Felicia Kelley - 5 years ago (2018-05-02) in reply to comment 2 by DeGraciaMathieu Reply

    Great job


PHP Forms Class with HTML Generator and JavaScript Validation: HTML forms generation and validation.

This recommendation solves the problem.
This recommendation does not solve the problem.

0

Picture of tony jabbour by tony jabbour Reputation 50 - 7 years ago (2017-03-23) Comment

i am using this currently to generate a unique license try to edit it to your needs

function UniqueLicense(){

$Block1 = substr(uniqid(), 8, 5);

$TimeArray = explode('.', microtime()); $TimeArray2 = explode(' ', $TimeArray[1]); $TimeArray3 = sha1(base_convert($TimeArray2[0] . $TimeArray2[1], 10, 16)); $Block2 = substr($TimeArray3, 5, 5);

$Sub1 = sha1(substr($TimeArray3, 10, 5)); $Sub2 = substr($Sub1,rand(0, strlen($Sub1) - 5),rand(0, strlen($Sub1) - 5) + 5); $Block3 = substr($Sub2, 0, 5);

$Block4 = substr(rand(),0,5);

//$BlockLicense1 .= $Block1 . '-' . $Block2 . '-' . $Block3 . '-' . $Block4 ;

$char = "0213456789abcdefghijklmnopqrstuvwxyz"; $Block5 =substr(str_shuffle(str_repeat($char, 5)), 0,2); $Block6 = substr(str_shuffle(str_repeat($char, 5)), 0,2); $Sub3 = substr(str_shuffle(str_repeat($char, 5)), 0,5); $sub4 = substr(MD5($Sub3), 10, 5);

//$BlockLicense2 .= $Block5 . '-' . $Block6 . '-' . $Block7 . '-' . $Block8 ;

$Block9 = str_replace(substr($Block4, 3, 2), $Block5, $Block4);

$Block10 = str_replace(substr($Block2, 3, 2), $Block6, $Block2);

$subs = array($Sub3,$sub4,$Block1,$Block3); $rand = array_rand($subs,2); $Block11 = $subs[$rand[0]]; $Block12 = $subs[$rand[1]];


$BlockLicense .= $Block9 . '-' . $Block10 . '-' . $Block11 . '-' . $Block12 ;

return strtoupper($BlockLicense); }

  • 1 Comment
  • 1. Picture of Manuel Lemos by Manuel Lemos package author package author - 7 years ago (2017-03-23) Reply

    You are not recommending a package class.


Recommend package
: 
: