Download the PHP package awaresoftware/custom-id without Composer

On this page you can find all versions of the php package awaresoftware/custom-id. 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 custom-id

Custom ID Generator for Laravel

A Laravel package for generating unique custom IDs with configurable character sets, lengths, and prefixes. Perfect for creating human-readable, collision-resistant identifiers for your Eloquent models.

Features

Installation

Quick Start

1. Use the Trait

Add the HasCustomId trait to your model:

2. Update Your Migration

Set the primary key as a string:

3. Create Records

IDs are generated automatically:

Configuration

Publish the config file:

Or publish everything at once (config + migration):

Edit config/custom-id.php:

Per-Model Configuration

Override getCustomIdConfig() in your model:

Or load from your app's config:

Converting Users Table to Custom IDs

The package includes an optional migration to convert your existing users table from auto-incrementing integer IDs to custom string IDs.

Publish the Migration

This will create a timestamped migration in your database/migrations directory.

Configure the Migration

Before running the migration, update your config/custom-id.php:

Auto-Detected Tables

The migration automatically handles these common Laravel tables:

Run the Migration

Update Your User Model

Add the HasCustomId trait to your User model:

Important Notes

  1. Backup your database before running this migration
  2. Test thoroughly in a development environment first
  3. The migration supports MySQL, PostgreSQL, and SQLite
  4. Reverting the migration assigns new sequential integer IDs (original IDs cannot be restored)
  5. Related tables configured in the config will have their columns converted to string type

Advanced Usage

Soft Delete Awareness

The package automatically detects if your model uses SoftDeletes and includes trashed records when checking for ID uniqueness:

Race Condition Handling

Two-phase approach separates collision detection from race condition handling:

  1. Collision detection — The service checks existing records (including soft-deleted) before assigning an ID
  2. Concurrent inserts — performInsert() catches UniqueConstraintViolationException and regenerates the ID, retrying up to 3 times

Custom Exception Handling

Generation failures — after exhausting all retry attempts:

Configuration errors — invalid config values throw InvalidArgumentException:

Using the Service Directly

Using the Facade

Character Sets

Default Character Set

Excludes: 0, O, 1, I, L (ambiguous characters)

Common Alternatives

Alphanumeric (uppercase):

Alphanumeric (mixed case):

Numbers only:

Base32 (Crockford):

Collision Probability

With default settings (31 characters, length 8):

Increase length for larger datasets:

Testing

Requirements

License

MIT License - see LICENSE file for details.

Credits

Developed by Aware j.d.o.o.

Support


All versions of custom-id with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^11.0|^12.0|^13.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 awaresoftware/custom-id contains the following files

Loading the files please wait ...