{"id":14036801,"url":"https://github.com/SiroDiaz/Base62","last_synced_at":"2025-07-27T04:32:15.584Z","repository":{"id":17752765,"uuid":"20604433","full_name":"SiroDiaz/Base62","owner":"SiroDiaz","description":"PHP Base62 encoder and decoder for integers and big integers with Laravel 5 support.","archived":false,"fork":false,"pushed_at":"2020-08-10T14:41:56.000Z","size":70,"stargazers_count":17,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-10-30T04:31:01.339Z","etag":null,"topics":["base62","big-int","bigint","biginteger","composer","decoder","encoding","laravel","laravel-5-package","laravel-framework","laravel-package","php","shortener","url-shortener"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"kalbunna/children-in-families-web","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SiroDiaz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-07T22:40:23.000Z","updated_at":"2023-03-19T17:44:07.000Z","dependencies_parsed_at":"2022-09-24T18:51:27.312Z","dependency_job_id":null,"html_url":"https://github.com/SiroDiaz/Base62","commit_stats":null,"previous_names":[],"tags_count":5,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SiroDiaz%2FBase62","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SiroDiaz%2FBase62/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SiroDiaz%2FBase62/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SiroDiaz%2FBase62/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SiroDiaz","download_url":"https://codeload.github.com/SiroDiaz/Base62/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":214982087,"owners_count":15811653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["base62","big-int","bigint","biginteger","composer","decoder","encoding","laravel","laravel-5-package","laravel-framework","laravel-package","php","shortener","url-shortener"],"created_at":"2024-08-12T03:02:14.320Z","updated_at":"2024-12-02T16:30:42.107Z","avatar_url":"https://github.com/SiroDiaz.png","language":"PHP","readme":"# Base62\n\n[![Build Status](https://travis-ci.org/SiroDiaz/Base62.svg?branch=develop)](https://travis-ci.org/SiroDiaz/Base62)\n[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=3XKLA6VTYVSKW\u0026source=url)\n\nBase62 encoder and decorder also for big numbers. Useful to short database numeric ids in URLs.\n\n## requirements\n\n* requires PHP \u003e= 7.1.0 or higher\n* Composer\n* GMP (preferred) or BCMath extensions enabled.\n\n## Composer\n\n\t$ composer require base62/base62\n\n## Laravel 5\n\nYou just need to follow the composer command listed before and then you have to publish the base62.php config file into\nthe config path of Laravel with the following command:\n\n\t$ php artisan vendor:publish --tag=base62/base62\n\nThen you can change in `config/base62.php` the default driver that is 'basic' (the PHP encoder implementation) for another supported\nby your host. It is recomended to use GMP extension because it is the most fast solution.\nAllowed encoders and decoders drivers are:\n- basic\n- gmp\n- bcmath\n\n## Quick Start and Examples\n\n#### Methods\n\nencode and decode\n\n#### Encoders/Decoders drivers\n\n- basic\n- gmp\n- bcmath\n\n#### Examples\n\nEncoding and decoding litle numbers.\n\n```php\nrequire 'vendor/autoload.php';\n\nuse Base62\\Base62;\n\n$base62 = new Base62();\t\t// by default use 'basic' driver. It is the default PHP encoder and decoder\n$encodedValue = $base62-\u003eencode(200000);\t// 'Q1O'\n$decodedValue = $base62-\u003edecode($encodedValue); // 200000\n```\n\nEncoding and decoding big numbers. An important thing you must take in count: your PHP can be 32 or 64 bit,\nthis means that a representation of an integer can take a maximum or 32 or 64 bit. This is a important limitation\nwhen you work with big integers, but for solve this problem we have GMP and BCMath native extensions for PHP.\n\n\n```php\nrequire 'vendor/autoload.php';\n\nuse Base62\\Base62;\n\n// unsigned bigint (MySQL) 18446744073709551615\n$id = '214748364787898954454';\n\n$base62 = new Base62('gmp');\n// print encoded base62 number id\n$encodedValue = $base62-\u003eencode($id);\t// '47rhmv5JHMPe'\n$decodedValue = $base62-\u003edecode($base62-\u003eencode($id)); // '214748364787898954454'\n```\n\nNote that encode method uses strings as argument and not an integer. This is the best option by a simple reason.\nImagine that you uses an integer that can not been represented by native PHP 32 or 64 bit interpreter, what would happen?\nSimple, the integer is truncated and can take negative values or a different positive number.\n\n## License\n\n[MIT License](https://opensource.org/licenses/MIT) Copyright © 2014-present, Siro Díaz Palazón\n","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=3XKLA6VTYVSKW\u0026source=url"],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSiroDiaz%2FBase62","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSiroDiaz%2FBase62","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSiroDiaz%2FBase62/lists"}