Download the PHP package goldspecdigital/laravel-eloquent-uuid without Composer

On this page you can find all versions of the php package goldspecdigital/laravel-eloquent-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-eloquent-uuid

Eloquent UUID

GitHub stars

GitHub tag (latest SemVer) Build status Packagist PHP from Packagist Packagist

Introduction

A simple drop-in solution for providing UUID support for the IDs of your Eloquent models.

Both v1 and v4 IDs are supported out of the box, however should you need v3 or v5 support, you can easily add this in.

Installing

Reference the table below for the correct version to use in conjunction with the version of Laravel you have installed:

Laravel This package
v5.8.* v1.*
v6.* v6.*
v7.* v7.*
v8.* v8.*
v9.* v9.*
v10.* v10.*

You can install the package via composer:

Usage

There are two ways to use this package:

  1. By extending the provided model classes (preferred and simplest method).
  2. By using the provided model trait (allows for extending another model class).

Extending model

When creating a Eloquent model, instead of extending the standard Laravel model class, extend from the model class provided by this package:

Extending user model

The User model that comes with a standard Laravel install has some extra configuration which is implemented in its parent class. This configuration only consists of implementing several interfaces and using several traits.

A drop-in replacement has been provided which you can use just as above, by extending the User class provided by this package:

Using trait

As an alternative to extending the classes in the examples above, you also have the ability to use the provided trait instead. This requires a more involved setup process but allows you to extend your models from another class if needed:

Generating UUIDs

If you don't specify the value for the primary key of your model, a UUID will be automatically generated. However, if you do specify your own UUID then it will not generate one, but instead use the one you have explicitly provided. This can be useful when needing the know the ID of the model before you have created it:

Specifying UUID versions

By default, v4 UUIDs will be used for your models. However, you can also specify v1 UUIDs to be used by setting the following property/method on your model:

When extending the class

When using the trait

Support for v3 and v5

Should you need support for v3 or v5 UUIDs, you can simply override the method which is responsible for generating the UUIDs:

Creating models

In addition of the make:model artisan command, you will now have access to uuid:make:model which has all the functionality of the standard make:model command (with exception of not being able to create a pivot model):

Database migrations

The default primary ID column used in migrations will not work with UUID primary keys, as the default column type is an unsigned integer. UUIDs are 36 character strings so we must specify this in our migrations:

Running the tests

To run the test suite you can use the following command:

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.


All versions of laravel-eloquent-uuid with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
laravel/framework Version ^10.0
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 goldspecdigital/laravel-eloquent-uuid contains the following files

Loading the files please wait ....