lucasmichot/eloquentuuid
Composer 安装命令:
composer require lucasmichot/eloquentuuid
包简介
Provides a unique Base62-encoded UUID representing a given state of a model instance
README 文档
README
Provides a unique Base62-encoded UUID representing a given state of a model instance.
This is particularly useful to keep track of model versions.
Why Base62 ?
Compared to MD5, a Base62 hash is shorter and the alphabet used makes it cleaner to process, when used in a shorten URL for instance, or when stored in a database.
Requirements:
- PHP >= 5.4
- Laravel 4.2
Package installation
Begin by installing this package through Composer. Edit your project's composer.json file to require lucasmichot/eloquentuuid.
"require": { "lucasmichot/eloquentuuid": "0.*" }
Next, update Composer from the Terminal:
$ composer update
You can achieve these operations with this one-liner command :
$ composer require "lucasmichot/eloquentuuid:0.*"
Usage
use Lucasmichot\Eloquentuuid\UuidTrait; class Post extends Eloquent { use UuidTrait; // the code of your model comes here }
Accessing the UUID :
$post = Post::find(1); // update the attributes of the post echo $post->uuid();
Each time the model is modified, the UUID is changed accordingly.
TODO
- Finish documentation
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-06-30