mallardduck/laravel-humanoid

This is my package laravel-humanoid

dev-main 2024-12-21 01:12 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package allows you to configure a HumanoID generator once and use it anywhere in your Laravel application. Once you've configured your site/apps HumanoID generator it's as easy as:

Generates a HumanoID via your preconfigured for (int) 42

HumanoID::create(42); // Using a facade (alias) to access the singleton.
app(\RobThree\HumanoID\HumanoID::class)->create(42); // Or, get it via the app container.
app(\MallardDuck\LaravelHumanoID\Facades\HumanoID::class)->create(42); // Or, get it via the app container.

A message to Russian 🇷🇺 people

If you currently live in Russia, please read this message.

Installation

You can install the package via composer:

composer require mallardduck/laravel-humanoid

You can publish the config file with:

php artisan vendor:publish --tag="laravel-humanoid-config"

This is the contents of the published config file:

return [
    'defaultGeneratorConfig' => (class_exists('\App\HumanoID\MyAppConfig')) ? \App\HumanoID\MyAppConfig::class : \MallardDuck\LaravelHumanoID\DefaultGeneratorConfig::class,
    'wordSetsBasePath' => env('APP_HUMANOID_BASE', resource_path('humanoid/')),
];

Usage

  1. Publish the necessary vendor files,
  2. Publish the config files (optional),
$humanoID = new HumanoID::create(42);
echo $humanoID; // 'Haumea-Pinwheel'

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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