spatie/mixed-content-scanner-cli
CLI tool to detect mixed content on HTTPS sites. Crawls pages and reports HTML elements whose URLs use http:// (images, scripts, iframes, forms, etc.). Install via Composer globally and run: mixed-content-scanner scan .
exec() or a custom Artisan command).ScanMixedContent command).browserling/screenshot-api or custom scripts using Symfony Panther).exec(), sanitize inputs to prevent command injection.Http client + regex) or commercial tools (e.g., Sqreen, Datadog) better fit needs.php artisan scan:mixed-content).exec).Symfony\Component\DomCrawler) for post-processing.composer global require spatie/mixed-content-scanner-cli).mixed-content-scanner scan https://example.com.// app/Console/Commands/ScanMixedContent.php
class ScanMixedContent extends Command {
protected $signature = 'scan:mixed-content {url?}';
protected $description = 'Scan a URL for mixed content issues';
public function handle() {
$url = $this->argument('url') ?? config('app.url');
$command = "mixed-content-scanner scan {$url}";
$output = shell_exec($command);
$this->info($output);
}
}
app/Console/Kernel.php.deploy.php or GitHub Actions:
- name: Scan for mixed content
run: php artisan scan:mixed-content
cron (e.g., daily):
0 3 * * * cd /path/to/app && php artisan scan:mixed-content >> /var/log/mixed-content.log
// Example: Store findings in `mixed_content_issues` table
$issues = json_decode($output, true);
foreach ($issues['issues'] as $issue) {
MixedContentIssue::create([
'url' => $issue['url'],
'mixed_url' => $issue['mixedUrl'],
'severity' => $issue['severity'],
]);
}
composer why-not spatie/mixed-content-scanner-cli to track updates.--timeout flag).file_put_contents(storage_path('logs/mixed-content-debug.log'), $output);
parallel-lint pattern):
foreach ($urls as $url) {
ScanMixedContentJob::dispatch($url)->delay(now()->addMinutes(1));
}
| Failure Scenario | Impact | Mitigation |
How can I help you explore Laravel packages today?