Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Generator(s)

Bruno Meilick edited this page Jul 8, 2020 · 5 revisions

You can set a different Generator or define your own using the bnomei.autoid.generator option.

site/config/config.php

return [
    'bnomei.autoid.generator' => function () {
        // override with custom callback if needed
        return (new \Bnomei\TokenGenerator())->generate();
        // return (new \Bnomei\IncrementingGenerator(0))->generate();
        // return (new \Bnomei\NanoGenerator())->generate();
        // return (new \Bnomei\UUIDGenerator(site()->url()))->generate();
    },
    // ... other options
];

Get a new AutoID value not in use yet

In some edgecases you might need to get an AutoID manually but usually the hooks registered by the plugin will take care of everything on their own.

$autoid = \Bnomei\AutoID::generate(); // null | string
// or
$autoid = autoid();

Settings

bnomei.autoid. Default Description
generator callback alphanumeric hash value generator (~2.8 trillion possibilites)
generator-break 42 try max n-times to generate and verify uniqueness of hash
Clone this wiki locally