All Projects → thamtech → yii2-uuid

thamtech / yii2-uuid

Licence: other
UUID Helper and validator for Yii 2

Programming Languages

PHP
23972 projects - #3 most used programming language

Labels

Projects that are alternatives of or similar to yii2-uuid

Uuid
Kotlin Multiplatform UUID
Stars: ✭ 146 (+342.42%)
Mutual labels:  uuid
Uuid
Erlang Native UUID Generation
Stars: ✭ 188 (+469.7%)
Mutual labels:  uuid
install
basic script for project installation
Stars: ✭ 17 (-48.48%)
Mutual labels:  yii2
Icicle
A distributed, k-sortable unique ID generation system using Redis and Lua.
Stars: ✭ 159 (+381.82%)
Mutual labels:  uuid
Msgphp
Reusable domain layers. Shipped with industry standard infrastructure.
Stars: ✭ 182 (+451.52%)
Mutual labels:  uuid
Ulid
Universally Unique Lexicographically Sortable Identifier (ULID) in Python 3
Stars: ✭ 216 (+554.55%)
Mutual labels:  uuid
Laravel Uuid
Laravel package to generate and to validate a UUID according to the RFC 4122 standard. Only support for version 1, 3, 4 and 5 UUID are built-in.
Stars: ✭ 1,717 (+5103.03%)
Mutual labels:  uuid
yii2-admin-theme
基于Yii2+layui的后台框架模板,实现了完善的RBAC权限控制
Stars: ✭ 87 (+163.64%)
Mutual labels:  yii2
Nanoid
A tiny, secure, URL-friendly, unique string ID generator for Rust
Stars: ✭ 188 (+469.7%)
Mutual labels:  uuid
Ulid
Universally Unique Lexicographically Sortable Identifier implementation for Ruby
Stars: ✭ 253 (+666.67%)
Mutual labels:  uuid
Lua Resty Jit Uuid
Fast and dependency-free UUID library for LuaJIT/ngx_lua
Stars: ✭ 169 (+412.12%)
Mutual labels:  uuid
Id Generator
生成带校验码的卡号、19位的Long ID、不大于22位的短UUID、短卡号、激活码、数字加密、付款码。分布式、基于内存、安全可靠、性能高。
Stars: ✭ 180 (+445.45%)
Mutual labels:  uuid
Ksuid
K-Sortable Globally Unique IDs
Stars: ✭ 3,202 (+9603.03%)
Mutual labels:  uuid
Zkudid
Generate and save permanent UDID with IDFV and keychain in iOS device.
Stars: ✭ 159 (+381.82%)
Mutual labels:  uuid
UUIDNext
A fast and modern .NET library to generate UUID/GUID that are either sequential and database friendly (versions 7), name based (versions 5) or random (version 4).
Stars: ✭ 84 (+154.55%)
Mutual labels:  uuid
Uuid
A PHP library for generating universally unique identifiers (UUIDs).
Stars: ✭ 11,475 (+34672.73%)
Mutual labels:  uuid
Python Wechat Itchat
微信机器人,基于Python itchat接口功能实例展示:01-itchat获取微信好友或者微信群分享文章、02-itchat获取微信公众号文章、03-itchat监听微信公众号发送的文章、04 itchat监听微信群或好友撤回的消息、05 itchat获得微信好友信息以及表图对比、06 python打印出微信被删除好友、07 itchat自动回复好友、08 itchat微信好友个性签名词云图、09 itchat微信好友性别比例、10 微信群或微信好友撤回消息拦截、11 itchat微信群或好友之间转发消息
Stars: ✭ 216 (+554.55%)
Mutual labels:  uuid
yii2-deferred-tasks
Yii2 extension for handling deferred tasks (background cron jobs)
Stars: ✭ 11 (-66.67%)
Mutual labels:  yii2
yii2-lets-talk
With this extension you can open chat with someone in popular messengers using the link on your website.
Stars: ✭ 15 (-54.55%)
Mutual labels:  yii2
Uuid
Go package for UUIDs based on RFC 4122 and DCE 1.1: Authentication and Security Services.
Stars: ✭ 3,237 (+9709.09%)
Mutual labels:  uuid

Yii 2 UUID Helper

UUID Helper and validator for Yii 2.

This library interfaces with ramsey/uuid to generate universally unique identifiers.

For license information check the LICENSE-file.

Latest Stable Version Build Status Scrutinizer Code Quality Code Coverage

Installation

The preferred way to install this extensions is through composer.

Either run

php composer.phar require --prefer-dist thamtech/yii2-uuid

or add

"thamtech/yii2-uuid": "*"

to the require section of your composer.json file.

Usage

New UUID

Generate a new UUID (version 4 by default):

$uuid = \thamtech\uuid\helpers\UuidHelper::uuid();

Ad-Hoc Validation

Validate that a string is formatted in the canonical format using hexadecimal text with inserted hyphen characters (case insensitive):

$uuid = 'de305d54-75b4-431b-adb2-eb6b9e546014';
$isValid = \thamtech\uuid\helpers\UuidHelper::isValid($uuid); // true

$uuid = 'not-a-uuid';
$isValid = \thamtech\uuid\helpers\UuidHelper::isValid($uuid); // false

// or using the Validator class directly
$validator = new \thamtech\uuid\validators\UuidValidator();
if ($validator->validate($uuid, $error)) {
    // valid
} else {
    // not valid
    echo $error
}

Or you can include the use lines, especially if you will be making multiple uuid calls within a file:

use thamtech\uuid\helpers\UuidHelper;
use thamtech\uuid\helpers\UuidValidator;

// ...

$uuid = 'de305d54-75b4-431b-adb2-eb6b9e546014';
$isValid = UuidHelper::isValid($uuid); // true

$uuid = 'not-a-uuid';
$isValid = UuidHelper::isValid($uuid); // false

// or using the Validator class directly
$validator = new UuidValidator();
if ($validator->validate($uuid, $error)) {
    // valid
} else {
    // not valid
    echo $error
}

Field Validation

Incorporate this same validation into your model:

public function rules()
{
    return [
        [['uuid'], 'thamtech\uuid\validators\UuidValidator'],
    ];
}

See Also

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].