1. Go to this page and download the library: Download dgtlss/warden 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/ */
dgtlss / warden example snippets
namespace App\Audits;
use Dgtlss\Warden\Contracts\CustomAudit;
class DatabasePasswordAudit implements CustomAudit
{
public function audit(): bool
{
$dbPassword = env('DB_PASSWORD', '');
return !in_array(strtolower($dbPassword), ['password', '123456', 'admin']);
}
public function getFindings(): array
{
return [
[
'package' => 'environment',
'title' => 'Weak Database Password',
'severity' => 'critical',
'description' => 'Database password is weak or commonly used',
'remediation' => 'Use a strong, unique password'
]
];
}
public function getName(): string
{
return 'Database Password Security';
}
public function getDescription(): string
{
return 'Checks for weak database passwords';
}
public function shouldRun(): bool
{
return !empty(env('DB_CONNECTION'));
}
}