alexanderzon/laravel-hashids
Composer 安装命令:
composer require alexanderzon/laravel-hashids
包简介
Fork from toran/hashids: Laravel package for Hashids
README 文档
README
This package uses the classes created by hashids.org
Generate hashes from numbers, like YouTube or Bitly. Use hashids when you do not want to expose your database ids to the user.
Installation
To get the latest version of Hashids simply require it in your composer.json file.
"alexanderzon/laravel-hashids": "dev-master"
You'll then need to run composer install to download it and have the autoloader updated.
Once Hashids is installed you need to register the service provider with the application. Open up config/app.php and find the providers key.
'AlexanderZon\Hashids\HashidsServiceProvider'
There is no need to add the Facade, the package will add it for you.
Publish the configurations
Run this on the command line from the root of your project:
$ php artisan config:publish alexanderzon/laravel-hashids
A configuration file will be publish to config/laravel-hashids.php.
Laravel 4 Installation
Add verison 1.0 of Hashids in your composer.json file.
"alexanderzon/laravel-hashids": "3.0.*"
And following the directions in the README on version 1.0.
Usage
Once you've followed all the steps and completed the installation you can use Hashids.
Encodeing
You can simply encode a single id:
Hashids::encode(1); // Returns Ri7Bi
or multiple..
Hashids::encode(1, 21, 12, 12, 666); // Returns MMtaUpSGhdA
Decodeing
Hashids::decode(Ri7Bi); // Returns int 1
or multiple..
Hashids::decode(MMtaUpSGhdA); // Returns array (size=5) 0 => int 1 1 => int 21 2 => int 12 3 => int 12 4 => int 666
Changelog
2.0.0
- Upgraded to Laravel 5
- Upgraded to Hashids 1.0.5
1.0.0
-
Several public functions are renamed to be more appropriate:
- Function
encrypt()changed toencode() - Function
decrypt()changed todecode() - Function
encryptHex()changed toencodeHex() - Function
decryptHex()changed todecodeHex()
Hashids was designed to encode integers, primary ids at most. Hashids is the wrong algorithm to encrypt sensitive data. So to encourage more appropriate use,
encrypt/decryptis being "downgraded" toencode/decode. - Function
-
Version tag added:
1.0 -
README.mdupdated
All credit for Hashids goes to Ivan Akimov (@ivanakimov), thanks to for making it!
alexanderzon/laravel-hashids 适用场景与选型建议
alexanderzon/laravel-hashids 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 99 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 04 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「hash」 「laravel」 「encrypt」 「decrypt」 「hashid」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 alexanderzon/laravel-hashids 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alexanderzon/laravel-hashids 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 alexanderzon/laravel-hashids 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Encrypted symfony entity's by verified and standardized libraries
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Article CSS-ID Frontend Output Optimization
♺ Laravel Nova Hashids card. Convert your ids.
A library for reading KeePass 2.x databases
A PHP library for RSA encryption and decryption using the OpenSSL extension
统计信息
- 总下载量: 99
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD
- 更新时间: 2015-04-09