class HashManager extends Manager implements Hasher mixin Hasher

Traits

Properties

protected Repository $config

The configuration repository instance.

from  Manager
protected array $customCreators

The registered custom driver creators.

from  Manager
protected array $drivers

The array of created "drivers".

from  Manager

Methods

Closure|null
bindCallbackToSelf(Closure $callback)

Bind the provided callback to the class instance.

__construct(Container $container)

Create a new manager instance.

from  Manager
string
getDefaultDriver()

Get the default driver name.

mixed
driver(UnitEnum|string|null $driver = null)

Get a driver instance.

from  Manager
mixed
createDriver(string $driver)

Create a new driver instance.

from  Manager
mixed
callCustomCreator(string $driver)

Call a custom driver creator.

from  Manager
extend(string $driver, Closure $callback)

Register a custom driver creator Closure.

from  Manager
array
getDrivers()

Get all of the created "drivers".

from  Manager
getContainer()

Get the container instance used by the manager.

from  Manager
setContainer(Container $container)

Set the container instance used by the manager.

from  Manager
forgetDrivers()

Forget all of the resolved driver instances.

from  Manager
mixed
__call(string $method, array $parameters)

Dynamically call the default driver instance.

from  Manager
createBcryptDriver()

Create an instance of the Bcrypt hash Driver.

createArgonDriver()

Create an instance of the Argon2i hash Driver.

createArgon2idDriver()

Create an instance of the Argon2id hash Driver.

array
info(string $hashedValue)

Get information about the given hashed value.

string
make(string $value, array $options = [])

Hash the given value.

bool
check(string $value, string|null $hashedValue, array $options = [])

Check the given plain value against a hash.

bool
needsRehash(string|null $hashedValue, array $options = [])

Check if the given hash has been hashed using the given options.

bool
isHashed(string $value)

Determine if a given string is already hashed.

bool
verifyConfiguration(string $hashedValue)

Verifies that the configuration is less than or equal to what is configured.

Details

protected Closure|null bindCallbackToSelf(Closure $callback)

Bind the provided callback to the class instance.

Parameters

Closure $callback

Return Value

Closure|null

Exceptions

ReflectionException

in Manager at line 37
__construct(Container $container)

Create a new manager instance.

Parameters

Container $container

at line 99
string getDefaultDriver()

Get the default driver name.

Return Value

string

in Manager at line 53
mixed driver(UnitEnum|string|null $driver = null)

Get a driver instance.

Parameters

UnitEnum|string|null $driver

Return Value

mixed

Exceptions

InvalidArgumentException

in Manager at line 78
protected mixed createDriver(string $driver)

Create a new driver instance.

Parameters

string $driver

Return Value

mixed

Exceptions

InvalidArgumentException

in Manager at line 99
protected mixed callCustomCreator(string $driver)

Call a custom driver creator.

Parameters

string $driver

Return Value

mixed

in Manager at line 112
Manager extend(string $driver, Closure $callback)

Register a custom driver creator Closure.

Boot-only. The callback persists in the singleton's customCreators array for the worker lifetime and applies to every subsequent driver resolution.

Parameters

string $driver
Closure $callback

Return Value

Manager

in Manager at line 129
array getDrivers()

Get all of the created "drivers".

Return Value

array

in Manager at line 137
Container getContainer()

Get the container instance used by the manager.

Return Value

Container

in Manager at line 151
Manager setContainer(Container $container)

Set the container instance used by the manager.

Tests only. Swaps the singleton's container reference; per-request use races across coroutines and breaks every concurrent driver resolution through this manager.

Parameters

Container $container

Return Value

Manager

in Manager at line 167
Manager forgetDrivers()

Forget all of the resolved driver instances.

Boot or tests only. Clears the singleton's driver cache; concurrent coroutines may already hold references that next resolution will not share.

Return Value

Manager

in Manager at line 177
mixed __call(string $method, array $parameters)

Dynamically call the default driver instance.

Parameters

string $method
array $parameters

Return Value

mixed

at line 19
BcryptHasher createBcryptDriver()

Create an instance of the Bcrypt hash Driver.

Return Value

BcryptHasher

at line 27
ArgonHasher createArgonDriver()

Create an instance of the Argon2i hash Driver.

Return Value

ArgonHasher

at line 35
Argon2IdHasher createArgon2idDriver()

Create an instance of the Argon2id hash Driver.

Return Value

Argon2IdHasher

at line 43
array info(string $hashedValue)

Get information about the given hashed value.

Parameters

string $hashedValue

Return Value

array

at line 51
string make(string $value, array $options = [])

Hash the given value.

Parameters

string $value
array $options

Return Value

string

at line 59
bool check(string $value, string|null $hashedValue, array $options = [])

Check the given plain value against a hash.

Parameters

string $value
string|null $hashedValue
array $options

Return Value

bool

at line 67
bool needsRehash(string|null $hashedValue, array $options = [])

Check if the given hash has been hashed using the given options.

Parameters

string|null $hashedValue
array $options

Return Value

bool

at line 75
bool isHashed(string $value)

Determine if a given string is already hashed.

Parameters

string $value

Return Value

bool

at line 85
bool verifyConfiguration(string $hashedValue)

internal  
 

Verifies that the configuration is less than or equal to what is configured.

Parameters

string $hashedValue

Return Value

bool