PHP code example of statikbe / laravel-security-txt

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

    

statikbe / laravel-security-txt example snippets


return [
    // Enable/disable the /.well-known/security.txt route
    'enabled' => env('SECURITY_TXT_ENABLED', true),

    // Remote URL to fetch the template from
    'template_url' => env('SECURITY_TXT_TEMPLATE_URL'),

    // Days until expiration (default: 365)
    'expires_days' => env('SECURITY_TXT_EXPIRES_DAYS', 365),

    // Where to store the generated file
    'output_path' => storage_path('security.txt'),

    // Placeholder mappings
    'placeholders' => [
        'CONTACT_EMAIL' => '[email protected]',
        'PGP_KEY_URL' => fn() => config('app.url') . '/pgp-key.txt',
    ],

    // Middleware for the route
    'middleware' => ['web'],
];

'placeholders' => [
    'CONTACT_EMAIL' => '[email protected]',
    'PGP_KEY_URL' => fn () => config('app.url') . '/pgp-key.txt',
    'CANONICAL_URL' => fn () => config('app.url') . '/.well-known/security.txt',
],

use Illuminate\Support\Facades\Schedule;

Schedule::command('security-txt:update')->weekly();
bash
php artisan vendor:publish --tag="security-txt-config"
text
Contact: mailto:{{CONTACT_EMAIL}}
Expires: {{EXPIRES}}
Encryption: {{PGP_KEY_URL}}
Preferred-Languages: en
bash
php artisan security-txt:update
bash
php artisan security-txt:update --expires-days=30