-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d239320
Showing
8 changed files
with
2,080 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
vendor | ||
runTest.bat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2023 Hassan Azzi | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is furnished | ||
to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# AlphaID | ||
|
||
AlphaID let you convert any integer to a short alphanumeric version. It can be useful for generating short, unique, and obfuscated identifiers. | ||
|
||
## Requirements | ||
|
||
PHP 7.3 and later. | ||
|
||
## Installation (Composer) | ||
|
||
You can install the bindings via [Composer](http://getcomposer.org/). Run the following command: | ||
|
||
```bash | ||
composer require devknown/alpha-id | ||
``` | ||
|
||
To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading): | ||
|
||
```php | ||
require_once('vendor/autoload.php'); | ||
``` | ||
|
||
## Getting Started | ||
|
||
Simple usage looks like: | ||
|
||
```php | ||
|
||
// convert number to a short string | ||
echo \Devknown\AlphaID::convert(258456357951); // Output: '4y7exoH' | ||
|
||
// recover the original number from the short string | ||
echo \Devknown\AlphaID::recover('4y7exoH'); // Output: 258456357951 | ||
|
||
``` | ||
|
||
Convert with key: | ||
|
||
```php | ||
use Devknown\AlphaID; | ||
|
||
AlphaID::config('my_key'); | ||
|
||
echo AlphaID::convert(258456357951); | ||
// the output this time will be '4ymMZq9' | ||
|
||
echo AlphaID::recover('4ymMZq9'); | ||
// the recover output this time will be 258456357951 | ||
|
||
``` | ||
|
||
## License | ||
|
||
AlphaID is open-source software licensed under the [MIT license](https://opensource.org/licenses/MIT). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "devknown/alpha-id", | ||
"type": "library", | ||
"description": "Convert any integer to a short alphanumeric version.", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Hassan Azzi", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=7.3" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^9.5" | ||
}, | ||
"autoload": { | ||
"psr-4": { "Devknown\\": "src/Devknown/" } | ||
} | ||
} |
Oops, something went wrong.