PHP Classes
elePHPant
Icontem

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

by mzer terungwa - 1 month 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.

0

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

1 Recommendation

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.

-1

by tony jabbour Reputation 40 - 20 hours 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. by Manuel Lemos package author package author - 20 hours ago (2017-03-23) Reply

    You are not recommending a package class.


Recommend package
: 
: