1
2

More than 1 year has passed since last update.

laravel PHP バージョンを指定してuuidを生成する

Last updated at Posted at 2022-02-06

概要

  • uuid バージョン4の生成方法は下記で説明したが、その他のバージョンのuuidを取得する方法をまとめる
  • 本方法でバージョン1〜6までのuuidの生成をする事ができる。

方法

  • ramsey/uuidというcomposerのライブラリを取得して使用する。
  • 下記コマンドを実行してramsey/uuidを取得する。

    $ composer composer require ramsey/uuid
    
  • 下記の様にuseを記載することですぐにuuidを生成する事ができる。(下記はuuid バージョン4を生成)

    use Ramsey\Uuid\Uuid;
    
    $uuid4 = Uuid::uuid4();
    
  • いろいろなバージョンのuuid生成方法は下記に記載されているのでご参考に!

    Cursor_と_はじめに—_ramsey___uuid安定版マニュアル.png

参考文献

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2