PHP code example of andersonan / basic-auth-generator

1. Go to this page and download the library: Download andersonan/basic-auth-generator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

andersonan / basic-auth-generator example snippets


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

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