定制 alexanderzon/laravel-hashids 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alexanderzon/laravel-hashids

最新稳定版本:3.0.1

Composer 安装命令:

composer require alexanderzon/laravel-hashids

包简介

Fork from toran/hashids: Laravel package for Hashids

README 文档

README

Latest Stable Version Total Downloads

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 to encode()
    • Function decrypt() changed to decode()
    • Function encryptHex() changed to encodeHex()
    • Function decryptHex() changed to decodeHex()

    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/decrypt is being "downgraded" to encode/decode.

  • Version tag added: 1.0

  • README.md updated

All credit for Hashids goes to Ivan Akimov (@ivanakimov), thanks to for making it!

统计信息

  • 总下载量: 99
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: BSD
  • 更新时间: 2015-04-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固