Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
devknown committed Jun 17, 2023
0 parents commit d239320
Show file tree
Hide file tree
Showing 8 changed files with 2,080 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor
runTest.bat
19 changes: 19 additions & 0 deletions LICENSE
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.
54 changes: 54 additions & 0 deletions README.md
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).
21 changes: 21 additions & 0 deletions composer.json
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": "devknown@gmail.com"
}
],
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.5"
},
"autoload": {
"psr-4": { "Devknown\\": "src/Devknown/" }
}
}
Loading

0 comments on commit d239320

Please sign in to comment.