Download the PHP package klongchu/laravel-uuid without Composer

On this page you can find all versions of the php package klongchu/laravel-uuid. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-uuid

Laravel Uuid

Total Downloads Build Status codecov.io Latest Stable Version Licence

Laravel package to generate and to validate a universally unique identifier (UUID) according to the RFC 4122 standard. Support for version 1, 3, 4 and 5 UUIDs are built-in.

What's new in 4.*

Laravel-uuid is now ready for Laravel 8. It has the same requirements so that means PHP 7.3 or PHP 8. Laravel package auto-discovery is enabled, and you can now use the UUID validation. Validation examples are below and in the tests.

For older Laravel or PHP versions use older versions; see below...

What's new in 3.*

Laravel-uuid is now refactored for Laravel 5.5. It has the same requirements so that means PHP 7. Laravel package auto-discovery is enabled, and you can now use the UUID validation. Validation examples are below and in the tests.

Laravel 5.0, 5.1, 5.2, 5.3 and 5.4? use version 2

Laravel 4.*? use version 1

Installation

In Laravel 5.5 laravel-uuid will install via the new package discovery feature so you only need to add the package to your composer.json file

after installation you should see

and you are ready to go

Basic Usage

To quickly generate a UUID just do

This will generate a version 1 Uuid object with a random generated MAC address.

To echo out the generated UUID, cast it to a string

or

Advanced Usage

UUID creation

Generate a version 1, time-based, UUID. You can set the optional node to the MAC address. If not supplied it will generate a random MAC address.

Generate a version 3, name-based using MD5 hashing, UUID

Generate a version 4, truly random, UUID

Generate a version 5, name-based using SHA-1 hashing, UUID

Some magic features

To import a UUID

Extract the time for a time-based UUID (version 1)

Extract the version of an UUID

Eloquent UUID generation

If you want an UUID magically be generated in your Laravel models, just add this boot method to your Model.

This will generate a version 4 UUID when creating a new record.

Model binding to UUID instead of primary key

If you want to use the UUID in URLs instead of the primary key, you can add this to your model (where 'uuid' is the column name to store the UUID)

When you inject the model on your resource controller methods you get the correct record

Validation

Just use like any other Laravel validator.

'uuid-field' => 'uuid'

Or create a validator from scratch. In the example an Uuid object in validated. You can also validate strings $uuid->string, the URN $uuid->urn or the binary value $uuid->bytes

Notes

Full details on the UUID specification can be found on http://tools.ietf.org/html/rfc4122.


All versions of laravel-uuid with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0|^8.0|^8.1|^8.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package klongchu/laravel-uuid contains the following files

Loading the files please wait ....