This repository has been archived by the owner on Oct 6, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
];
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();
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 |