andersonan/basic-auth-generator

generate .htpasswd file to path/domain/.htpasswd

v1.0.0 2022-05-15 14:48 UTC

This package is auto-updated.

Last update: 2025-07-15 22:02:12 UTC


README

#install

composer require andersonan/basic-auth-generator

#nginx config

server {
    ....
    location / {
        ....
        autoindex on;
        auth_basic           "Administrator's Area";
        auth_basic_user_file /$path/.htpasswd;
    }
}

#generate .htpasswd file

$htpass = new GenerateHtpasswd($path, $domain);
$htpass->filePutHtpasswd([$user => $pass]);

htpasswd generate success fully to $path/$domain/.htpass