This can be a PHP5 class that can can help you generate a key for an especific consumer and validate it. Within the options, there are:
- It generates a 25 characters key
- You possibly can change the size of the important thing that might be generated (default 25)
- You possibly can set what characters would you like in the important thing (Default A-Z a-z 0-9 !@^$*()_+)
- You possibly can set the file the place might be saved the customers/keys
- The important thing comes with rawurlencode(), this may can help you move the important thing trough an URL
- The system doesn’t duplicates keys or usernames! If the entered username is repeated, the system will simply return the present key of the respective consumer
- You need to use this wherever you need (Integration is simply too straightforward)
- You don’t want database! And if you would like, you may combine this right into a database
The finality is which you can straightforward implement this class to your API and permit the managed use of it. With this class you solely generate and validate keys, permitting so as to add no matter you need. For instance, within the validating file it can save you in a database every petition and management them!
Why do you not strive it?
Score might be actually appreciated.
Questions? Strategies? Please, don’t doubt to go away a remark!
*Renewed code estructure
*Fastened bugs in validation/era. (unhealthy url-encoding)
*Added setFile(), setChars() and setLength()