An open API service indexing awesome lists of open source software.

https://github.com/tailflow/laravel-human-readable-keys

Generate Stripe-like IDs for Eloquent models
https://github.com/tailflow/laravel-human-readable-keys

Last synced: 2 months ago
JSON representation

Generate Stripe-like IDs for Eloquent models

Awesome Lists containing this project

README

        

# Laravel Human Readable Keys

[![Latest Version on Packagist](https://img.shields.io/packagist/v/tailflow/laravel-human-readable-keys.svg)](https://packagist.org/packages/tailflow/laravel-human-readable-keys)
[![Build Status on Github Actions](https://img.shields.io/github/actions/workflow/status/tailflow/laravel-human-readable-keys/ci.yml?branch=main)](https://github.com/tailflow/laravel-human-readable-keys/actions)

Have you ever wanted to generate Stripe-like IDs for your Eloquent models? This package does exactly that!

## Installation

You can install the package via composer:

```bash
composer require tailflow/laravel-human-readable-keys
```

## Usage

1. Change type of the `id` (or whatever your primary key column is) to `string` in the migration

```php
Schema::create('users', function (Blueprint $table) {
$table->string('id');

...
});
```

2. Add `HasHumanReadableKey` trait to a model

```php