{"id":37266331,"url":"https://github.com/rorecek/laravel-ulid","last_synced_at":"2026-01-16T00:33:44.799Z","repository":{"id":38454924,"uuid":"101539283","full_name":"rorecek/laravel-ulid","owner":"rorecek","description":"Laravel package for ULID (Universally Unique Lexicographically Sortable Identifier)","archived":false,"fork":false,"pushed_at":"2024-03-02T07:55:16.000Z","size":17,"stargazers_count":52,"open_issues_count":6,"forks_count":16,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-14T15:50:31.805Z","etag":null,"topics":["eloquent","generator","laravel","trait","ulid"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rorecek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-27T08:22:55.000Z","updated_at":"2024-06-19T11:00:48.000Z","dependencies_parsed_at":"2024-01-14T18:01:48.012Z","dependency_job_id":"94fae338-67bc-42eb-9db2-d2569960ec64","html_url":"https://github.com/rorecek/laravel-ulid","commit_stats":{"total_commits":19,"total_committers":5,"mean_commits":3.8,"dds":"0.21052631578947367","last_synced_commit":"972d98e1a22330f2bf9d8acbe36ff6d2ef6b4dc9"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/rorecek/laravel-ulid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rorecek%2Flaravel-ulid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rorecek%2Flaravel-ulid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rorecek%2Flaravel-ulid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rorecek%2Flaravel-ulid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rorecek","download_url":"https://codeload.github.com/rorecek/laravel-ulid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rorecek%2Flaravel-ulid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28474505,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T00:15:39.755Z","status":"ssl_error","status_checked_at":"2026-01-16T00:15:32.174Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eloquent","generator","laravel","trait","ulid"],"created_at":"2026-01-16T00:33:44.027Z","updated_at":"2026-01-16T00:33:44.783Z","avatar_url":"https://github.com/rorecek.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel ULID\n\nLaravel package to generate ULID (Universally Unique Lexicographically Sortable Identifier), which also contains trait for your models that will let you generate ULID ids for your Eloquent models automatically. Based on [robinvdvleuten/php-ulid](https://github.com/robinvdvleuten/php-ulid).\n\n### What is a ULID?\n\nIn many cases universally unique identifier (UUID) can be suboptimal for many uses-cases because:\n\n* It isn't the most character efficient way of encoding 128 bits of randomness\n* UUID v1/v2 is impractical in many environments, as it requires access to a unique, stable MAC address\n* UUID v3/v5 requires a unique seed and produces randomly distributed IDs, which can cause fragmentation in many data structures\n* UUID v4 provides no other information than randomness which can cause fragmentation in many data structures\n\nInstead, ULID offers:\n\n* 128-bit compatibility with UUID\n* 1.21e+24 unique ULIDs per millisecond\n* Lexicographically sortable!\n* Canonically encoded as a 26 character string, as opposed to the 36 character UUID\n* Uses Crockford's base32 for better efficiency and readability (5 bits per character)\n* Case insensitive\n* No special characters (URL safe)\n\nYou can read more [here](https://github.com/alizain/ulid)\n\n### What are the benefits?\n\n1. With distributed systems you can be pretty confident that the primary key’s will never collide.\n\n2. When building a large scale application when an auto increment primary key is not ideal.\n\n3. It makes replication trivial (as opposed to int’s, which makes it REALLY hard)\n\n4. Safe enough doesn’t show the user that you are getting information by id, for example `https://example.com/item/10`\n\n\n## Installation\n\nYou can install this package via composer using this command:\n\n``` bash\n composer require rorecek/laravel-ulid:^2.0\n```\n\n#### Laravel 5.5+\nThere is nothing else to do as the service provider and facade are going to be automaticaly discovered.\n\n#### Laravel 5.3 and 5.4\nYou must install the service provider and facade:\n\n```php\n// config/app.php\n'providers' =\u003e [\n    ...\n    Rorecek\\Ulid\\UlidServiceProvider::class,\n];\n\n...\n\n'aliases' =\u003e [\n    ...\n    'Ulid' =\u003e Rorecek\\Ulid\\Facades\\Ulid::class,\n];\n```\n\n\n## Usage\n\n### Migrations\n\nWhen using the migration you should change $table-\u003eincrements('id') to:\n\n``` php\n$table-\u003echar('id', 26)-\u003eprimary();\n```\n\n\u003e Simply, the schema seems something like this.\n\n``` php\nSchema::create('items', function (Blueprint $table) {\n  $table-\u003echar('id', 26)-\u003eprimary();\n  ....\n  ....\n  $table-\u003etimestamps();\n});\n```\n\nIf the related model is using an ULID, the column type should reflect that also.\n\n``` php\nSchema::create('items', function (Blueprint $table) {\n  $table-\u003echar('id', 26)-\u003eprimary();\n  ....\n  // related model that uses ULID\n  $table-\u003echar('category_id', 26);\n  $table-\u003eforeign('category_id')-\u003ereferences('id')-\u003eon('categories');\n  ....\n  $table-\u003etimestamps();\n});\n```\n\n### Models\n\nTo set up a model to use ULID, simply use the HasUlid trait.\n\n``` php\nuse Illuminate\\Database\\Eloquent\\Model;\nuse Rorecek\\Ulid\\HasUlid;\n\nclass Item extends Model\n{\n  use HasUlid;\n}\n```\n\n### Controller\n\nWhen you create a new instance of a model which uses ULIDs, this package will automatically add ULID as id of the model.\n\n``` php\n// 'HasUlid' trait will automatically generate and assign id field.\n$item = Item::create(['name' =\u003e 'Awesome item']);\necho $item-\u003eid;\n// 01brh9q9amqp7mt7xqqb6b5k58\n```\n\n\n## Support\n\nIf you believe you have found an issue, please report it using the [GitHub issue tracker](https://github.com/rorecek/laravel-ulid/issues), or better yet, fork the repository and submit a pull request.\n\nIf you're using this package, I'd love to hear your thoughts. Thanks!\n\n\n## License\n\nThe MIT License (MIT). [Pavel Rorecek](https://laravelist.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frorecek%2Flaravel-ulid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frorecek%2Flaravel-ulid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frorecek%2Flaravel-ulid/lists"}