Download the PHP package verbanent/eloquent-binary-uuid without Composer

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

Ordered binary UUID in Laravel / Eloquent

Quality Gate Status Downloads StyleCI CodeFactor Maintainability Rating Lines of Code Coverage Packagist PHP Version Support Packagist License

Based on articles about the optimization of UUID storage in databases, I decided to write a simple library that allows this in my projects. I based on the information available here:
https://www.percona.com/blog/2014/12/19/store-uuid-optimized-way/
https://www.percona.com/community-blog/2018/10/12/generating-identifiers-auto_increment-sequence/

The package currently only supports MySQL.

Installation

Please install the package via Composer:

Migration

Your model will use an ordered binary UUID, if you prepare a migration:

Or if you want to use a custom column name for the primary key:

Using UUID in models

All what you have to do, is use a new trait in models with UUID as a primary key:

The above example works for the column id. If you use custom name for UUID column, you need to define it:

Abstract model for model with UUID

For your convenience you can extend your model with AbstractModel:

The above example works for the column id. If you use custom name for UUID column, you need to define it:

Foreign binary UUID

If you would like to use UUID as a foreign key, use another trait and set $uuidable property for this model:

Getting a string form of UUID

The library is kept as simple as possible, so if you want to get a string form of UUID, just use a method:

or use a property, if you need a binary value:

Finding by primary UUID

For primary keys finding rows is simple and always return a model:

Finding by foreign UUID

For foreign keys finding rows requires a column name and returns collection of model:

Getting a foreign UUID string

You can print string form of your foreign UUID keys:

Because trying to have access to the property directly will print binary form of UUID:

Unit tests

Run this command if you want to check unit tests:

Or if you want to check code coverage:


All versions of eloquent-binary-uuid with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8
ramsey/uuid Version ^3.8|^4
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 verbanent/eloquent-binary-uuid contains the following files

Loading the files please wait ....