[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8336":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":15,"starSnapshotCount":15,"syncStatus":16,"lastSyncTime":34,"discoverSource":35},8336,"hashids","vinkla\u002Fhashids","vinkla","A small PHP library to generate YouTube-like ids from numbers. Use it when you don't want to expose your database ids to the user.","https:\u002F\u002Fhashids.org\u002Fphp",null,"PHP",5435,413,108,0,2,3,6,38.85,"MIT License",false,"master",[24,25,26,27,5,28,29,30],"composer-packages","database-ids","encoding","hash","ids","php","php-library","2026-06-12 02:01:52","[![hashids](https:\u002F\u002Fraw.githubusercontent.com\u002Fhashids\u002Fhashids.github.io\u002Fmaster\u002Fpublic\u002Fimg\u002Fhashids.gif \"Hashids\")](https:\u002F\u002Fhashids.org\u002F)\n\n[![Build Status](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002Fvinkla\u002Fhashids\u002Fphpunit.yml?branch=master&label=tests)](https:\u002F\u002Fgithub.com\u002Fvinkla\u002Fhashids\u002Factions)\n[![Monthly Downloads](https:\u002F\u002Fimg.shields.io\u002Fpackagist\u002Fdm\u002Fhashids\u002Fhashids)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fhashids\u002Fhashids\u002Fstats)\n[![Latest Version](https:\u002F\u002Fimg.shields.io\u002Fpackagist\u002Fv\u002Fhashids\u002Fhashids)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fhashids\u002Fhashids)\n\n**Hashids** is a small PHP library to generate YouTube-like ids from numbers. Use it when you don't want to expose your database numeric ids to users: [https:\u002F\u002Fhashids.org\u002Fphp](https:\u002F\u002Fhashids.org\u002Fphp)\n\n\u003Ca href=\"https:\u002F\u002Fsqids.org\u002F\">\n    \u003Cimg align=\"right\" src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F75864e3a-483c-4b6f-9b0b-66f5e3d6e736\" alt=\"Sqids\" width=\"100\" height=\"100\">\n\u003C\u002Fa>\n\n> [!NOTE]\n> The creator of Hashids has released a new, upgraded version rebranded as **Sqids**. However, Hashids will continue to be maintained and available for future use. For more information, please visit the [Sqids repository](https:\u002F\u002Fgithub.com\u002Fsqids\u002Fsqids-php) and learn how it compares to Hashids on the [Sqids website](https:\u002F\u002Fsqids.org\u002Ffaq#hashids).\n\n## Getting started\n\nRequire this package, with [Composer](https:\u002F\u002Fgetcomposer.org), in the root directory of your project.\n\n```bash\ncomposer require hashids\u002Fhashids\n```\n\nThen you can import the class into your application:\n\n```php\nuse Hashids\\Hashids;\n\n$hashids = new Hashids();\n\n$hashids->encode(1);\n```\n\n> **Note** Hashids require either [`bcmath`](https:\u002F\u002Fsecure.php.net\u002Fmanual\u002Fen\u002Fbook.bc.php) or [`gmp`](https:\u002F\u002Fsecure.php.net\u002Fmanual\u002Fen\u002Fbook.gmp.php) extension in order to work.\n\n## Quick Example\n\n```php\nuse Hashids\\Hashids;\n\n$hashids = new Hashids();\n\n$id = $hashids->encode(1, 2, 3); \u002F\u002F o2fXhV\n$numbers = $hashids->decode($id); \u002F\u002F [1, 2, 3]\n```\n\n## More Options\n\n#### A few more ways to pass input ids to the `encode()` function:\n\n```php\nuse Hashids\\Hashids;\n\n$hashids = new Hashids();\n\n$hashids->encode(1, 2, 3); \u002F\u002F o2fXhV\n$hashids->encode([1, 2, 3]); \u002F\u002F o2fXhV\n$hashids->encode('1', '2', '3'); \u002F\u002F o2fXhV\n$hashids->encode(['1', '2', '3']); \u002F\u002F o2fXhV\n```\n\n#### Making your output ids unique\n\nPass a project name to make your output ids unique:\n\n```php\nuse Hashids\\Hashids;\n\n$hashids = new Hashids('My Project');\n$hashids->encode(1, 2, 3); \u002F\u002F Z4UrtW\n\n$hashids = new Hashids('My Other Project');\n$hashids->encode(1, 2, 3); \u002F\u002F gPUasb\n```\n\n#### Use padding to make your output ids longer\n\nNote that output ids are only padded to fit **at least** a certain length. It doesn't mean that they will be *exactly* that length.\n\n```php\nuse Hashids\\Hashids;\n\n$hashids = new Hashids(); \u002F\u002F no padding\n$hashids->encode(1); \u002F\u002F jR\n\n$hashids = new Hashids('', 10); \u002F\u002F pad to length 10\n$hashids->encode(1); \u002F\u002F VolejRejNm\n```\n\n#### Using a custom alphabet\n\n```php\nuse Hashids\\Hashids;\n\n$hashids = new Hashids('', 0, 'abcdefghijklmnopqrstuvwxyz'); \u002F\u002F all lowercase\n$hashids->encode(1, 2, 3); \u002F\u002F mdfphx\n```\n\n#### Encode hex instead of numbers\n\nUseful if you want to encode [Mongo](https:\u002F\u002Fwww.mongodb.com)'s ObjectIds. Note that *there is no limit* on how large of a hex number you can pass (it does not have to be Mongo's ObjectId).\n\n```php\nuse Hashids\\Hashids;\n\n$hashids = new Hashids();\n\n$id = $hashids->encodeHex('507f1f77bcf86cd799439011'); \u002F\u002F y42LW46J9luq3Xq9XMly\n$hex = $hashids->decodeHex($id); \u002F\u002F 507f1f77bcf86cd799439011\n```\n\n## Pitfalls\n\n1. When decoding, output is always an array of numbers (even if you encoded only one number):\n\n\t```php\n\tuse Hashids\\Hashids;\n\n\t$hashids = new Hashids();\n\n\t$id = $hashids->encode(1);\n\n\t$hashids->decode($id); \u002F\u002F [1]\n\t```\n\n2. Encoding negative numbers is not supported.\n3. If you pass bogus input to `encode()`, an empty string will be returned:\n\n\t```php\n\tuse Hashids\\Hashids;\n\n\t$hashids = new Hashids();\n\n\t$id = $hashids->encode('123a');\n\n\t$id === ''; \u002F\u002F true\n\t```\n\n4. Do not use this library as a security measure. **Do not** encode sensitive data with it. Hashids is **not** an encryption library.\n\n# Randomness\n\nThe primary purpose of Hashids is to obfuscate numeric ids. It's **not** meant or tested to be used as a security or compression tool. Having said that, this algorithm does try to make these ids random and unpredictable:\n\nThere is no pattern shown when encoding multiple identical numbers (3 shown in the following example):\n\n```php\nuse Hashids\\Hashids;\n\n$hashids = new Hashids();\n\n$hashids->encode(5, 5, 5); \u002F\u002F A6t1tQ\n```\n\nThe same is true when encoding a series of numbers vs. encoding them separately:\n\n```php\nuse Hashids\\Hashids;\n\n$hashids = new Hashids();\n\n$hashids->encode(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); \u002F\u002F wpfLh9iwsqt0uyCEFjHM\n\n$hashids->encode(1); \u002F\u002F jR\n$hashids->encode(2); \u002F\u002F k5\n$hashids->encode(3); \u002F\u002F l5\n$hashids->encode(4); \u002F\u002F mO\n$hashids->encode(5); \u002F\u002F nR\n```\n\n## Curse words! #$%@\n\nThis code was written with the intent of placing the output ids in visible places, like the URL. Therefore, the algorithm tries to avoid generating most common English curse words by generating ids that never have the following letters next to each other:\n\n```\nc, f, h, i, s, t, u\n```\n","vinkla\u002Fhashids 是一个轻量级的 PHP 库，用于将数字转换为类似 YouTube 的 ID。其核心功能是通过编码和解码方法生成和解析短字符串 ID，从而隐藏数据库中的真实编号 ID，增强安全性。该库支持多种输入方式（如数组、多个参数等），并允许自定义项目名称以生成唯一的 ID，还可以设置输出 ID 的最小长度或使用自定义字符集。它适用于需要对用户隐藏内部数据结构标识符的各种 Web 应用场景，比如文章 ID、订单号等敏感信息的处理。","2026-06-11 03:17:24","top_language"]