Ramsey Uuid 不适用于新安装的 laravel 5.4

Ramsey Uuid is not working on newly installed laravel 5.4

我已经安装了 laravel 5.4 并且 Ramsey Uuid 已经在其中并且我尝试使用它。以下是代码

HomeController.php

use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
$uuid1 = Uuid::uuid1(); 
echo $uuid1->toString() . "\n";

但它给我以下错误。

Caught exception: When calling Ramsey\Uuid\Converter\Time\DegradedTimeConverter::calculateTime on a 32-bit system, Moontoast\Math\BigNumber must be present.

我已经安装了ramsey/uuid版本3.6.1

有什么建议吗,解决办法是什么?

Laravel 5.4没有问题。您应该通过执行

安装 https://github.com/moontoast/math
composer require "moontoast/math"

发生此错误的原因是您的环境不支持大整数(32 位操作系统等)。您可以在 ramsey/uuid

的代码中找到此解释