password_hash

Supported Versions: PHP 5 >= 5.5.0, PHP 7, PHP 8
Creates a password hash
<?php password_hash(string $password, string|int|null $algo, array $options = []): string
<?php     public function make($value, array $options = [])

    {

        $hash = @password_hash($value, $this->algorithm(), [

            'memory_cost' => $this->memory($options),

            'time_cost' => $this->time($options),

            'threads' => $this->threads($options),

        ]);



        if (! is_string($hash)) {

            throw new RuntimeException('Argon2 hashing not supported.');
<?php     public function make($value, array $options = [])

    {

        $hash = password_hash($value, PASSWORD_BCRYPT, [

            'cost' => $this->cost($options),

        ]);



        if ($hash === false) {

            throw new RuntimeException('Bcrypt hashing not supported.');