New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

lucasmichot/eloquentuuid

Provides a unique Base62-encoded UUID representing a given state of a model instance
18 2
Install
composer require lucasmichot/eloquentuuid
Latest Version:0.1.2
PHP:>=5.4.0
Laravel:4
License:MIT
Last Updated:Jul 21, 2014
Links: GitHub  ·  Packagist
Maintainer: lucasmichot

EloquentUUID

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:

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

Related Packages

stayallive/laravel-eloquent-uuid

Generate UUID for a Laravel Eloquent model attribute.

72,041 4
marquine/eloquent-uuid

Uuid primary key for Laravel Eloquent Models

11,536 7
theprivateer/eloquent-uuid

UUID utility traits for Laravel

7,181 1
imcity-tech/laravel-uuid

[fork] The package provides UUID keys functionality for Eloquent models with one...

1,690 0
dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

3,538,823 484

Version History

Version Released PHP Laravel License
0.1.2 >=5.4.0 4.2.* MIT
0.1.1 >=5.4.0 4.2.* MIT
0.1 >=5.4.0 4.2.*