Download the PHP package michalsn/codeigniter4-uuid without Composer

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

CodeIgniter 4 UUID

UUID and ULID support for CodeIgniter 4 with seamless Model integration.

PHPUnit PHPStan Deptrac Coverage Status

PHP CodeIgniter

Installation

Configuration

Publish the configuration file:

This creates app/Config/Uuid.php where you can customize the defaults:

Usage

Model Integration

Use the HasUuid trait to add UUID support to your models:

The trait automatically:

[!NOTE] If you already use initialize() method in your model, then you have to add $this->initUuid() call inside this method to make the UUID package work.

Cast Syntax

The uuid cast accepts optional parameters for version and storage type:

UUID on Non-Primary Key Fields

You can use UUIDs on any field, not just primary keys:

UUIDs are only auto-generated for the primary key field. For other fields, you must provide the value:

Storage Types

String Storage (default)

Stores UUIDs as 36-character strings (e.g., 550e8400-e29b-41d4-a716-446655440000).

Binary Storage

Stores UUIDs as 16-byte binary for better performance and smaller storage footprint, but at the cost of readability.

With binary storage:

UUID Service

Generate UUIDs using the service:

Working with UUIDs:

Parse existing UUIDs:

Validate UUIDs:

Supported UUID Versions

Version Description Use Case
v1 Timestamp + MAC address Legacy systems
v3 Namespace + name (MD5) Deterministic UUIDs
v4 Random General purpose
v5 Namespace + name (SHA1) Deterministic UUIDs
v6 Timestamp-ordered (reordered v1) Time-sortable
v7 Timestamp-ordered (Unix epoch) Recommended - Time-sortable, database-friendly
ulid Universally Unique Lexicographically Sortable Identifier Time-sortable, shorter string representation

Recommendation: Use UUID v7 for new projects. It provides:

Migration from v1

Breaking Changes

  1. Dependency Change: Switched from ramsey/uuid to symfony/uid
  2. UUID v2 Removed: UUID v2 (DCE Security) is no longer supported
  3. Removed Classes: UuidModel, UuidEntity, UuidCast (old location) removed
  4. New Trait-Based Approach: Use HasUuid trait instead of extending UuidModel
  5. Type-Safe Versions: Use UuidVersion and UuidType enum instead of string constants

Migration Steps

1. Update composer.json

Run composer update.

2. Update Model Classes

Before (v1):

After (v2):

3. Update Entity Classes

Before (v1):

After (v2):

Entities no longer need special handling. Use standard CodeIgniter entities - the model's cast handles UUID conversion automatically.

4. Update Configuration

Before (v1):

After (v2):

5. Update UUID String Conversion (Optional)

The old Ramsey UUID method names still work for backward compatibility:

6. Remove v2 Usage

If you were using UUID v2, you'll need to migrate to a different version (v4 or v7 recommended).

7. Accessing the Underlying Symfony UID (Optional)

If you need direct access to the underlying Symfony UID object:

New Features in v2

License

The MIT License (MIT). Please see License File for more information.


All versions of codeigniter4-uuid with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-ctype Version *
symfony/uid Version ^7.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 michalsn/codeigniter4-uuid contains the following files

Loading the files please wait ...