PHP code example of xchimx / laravel-security

1. Go to this page and download the library: Download xchimx/laravel-security 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/ */

    

xchimx / laravel-security example snippets


use Xchimx\LaravelSecurity\Models\SecurityAudit;

// Retrieve latest Composer audit
$audit = SecurityAudit::getLatestAudit('composer');

// Latest outdated check for NPM
$outdated = SecurityAudit::getLatestOutdated('npm');

// All audits with issuesen
$issues = SecurityAudit::withIssues()->get();

// Audits from the last 7 days
$recent = SecurityAudit::where('executed_at', '>=', now()->subDays(7))->get();
bash
php artisan vendor:publish --tag="security-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="security-config"
css
@source '../../../../vendor/xchimx/laravel-security/resources/views/**/*.blade.php';
bash
php artisan vendor:publish --tag="security-views"
bash
# Perform security audit
php artisan security:audit

# Check Composer only
php artisan security:audit --composer

# Check NPM only
php artisan security:audit --npm

# Check for outdated packages
php artisan security:outdated

# Check Composer only
php artisan security:outdated --composer

# Check NPM only
php artisan security:outdated --npm
bash
php artisan notifications:table
php artisan migrate