Skip to main content

Overview

Heimdinger.lol includes several custom Artisan commands for maintenance, deployment, and content management tasks. These commands are located in app/Console/Commands/.

Available Commands

Sitemap Generation

Generates XML sitemaps for search engine optimization.
php artisan sitemap:generate
File: app/Console/Commands/GenerateSitemapCommand.phpSignature: sitemap:generateDescription: Generate XML sitemaps for all pages
The command collects URLs from multiple sources and generates sitemap files:
1

Collect Static Pages

Gathers all static routes (home, about, FAQ, etc.) with priority and change frequency:
app/Console/Commands/GenerateSitemapCommand.php:63
$staticPages = [
    ['url' => route('home'), 'priority' => 1.0, 'changefreq' => 'daily'],
    ['url' => route('champions.index'), 'priority' => 0.9, 'changefreq' => 'weekly'],
    ['url' => route('skins.index'), 'priority' => 0.9, 'changefreq' => 'weekly'],
    // ... more pages
];
2

Collect Dynamic Content

Queries database for:
  • All blog posts from Sheets
  • All champions with slugs
  • All skins with slugs
  • All summoner icons with slugs
3

Generate Sitemap Files

Creates public/sitemap.xml or multiple files if over 50,000 URLs:
app/Console/Commands/GenerateSitemapCommand.php:50
if ($totalUrls > self::MAX_URLS_PER_SITEMAP) {
    $this->generateMultipleSitemaps($urls, $baseUrl);
} else {
    $this->generateSingleSitemap($urls, $baseUrl);
}
The base URL is configured via environment:
app/Console/Commands/GenerateSitemapCommand.php:29
$baseUrl = config('app.HEIMER_URL', 'https://heimerdinger.lol');
Set in your .env:
APP_URL=https://heimerdinger.lol
Output: Creates public/sitemap.xml accessible at https://yourdomain.com/sitemap.xml
Run this command after adding new champions, skins, or blog posts to update the sitemap.

Cloudflare Cache Purge

Purges the Cloudflare cache for the entire site.
php artisan cloudflare:purge
File: app/Console/Commands/CloudflarePurgeCommand.phpSignature: cloudflare:purgeDescription: Purge the Cloudflare cache
Makes an API request to Cloudflare to clear all cached content:
app/Console/Commands/CloudflarePurgeCommand.php:26
$response = $client->request(
    'POST',
    'https://api.cloudflare.com/client/v4/zones/'.$cf_zone_id.'/purge_cache',
    [
        'headers' => [
            'Authorization' => 'Bearer '.$cf_auth_bearer,
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'purge_everything' => true,
        ],
    ]
);
Requires Cloudflare credentials in config/cloudflare.php:
config/cloudflare.php
return [
    'cf_zone_id' => env('CLOUDFLARE_ZONE_ID'),
    'cf_auth_bearer' => env('CLOUDFLARE_AUTH_BEARER'),
];
Set in .env:
.env.example:34
CLOUDFLARE_ZONE_ID="YOUR_CLOUDFLARE_ZONE"
CLOUDFLARE_AUTH_BEARER="YOUR_CLOUDFLARE_AUTH_BEARER"
This command only runs in production environment. It will silently exit in local/staging environments.
When to Use:
  • After deploying new content
  • When updating static assets
  • After changing CSS/JS files
  • When skin/champion data updates

User Creation

Creates a new user account from the command line.
php artisan user:create
File: app/Console/Commands/UserCreateCommand.phpSignature: user:createDescription: Create a new user from CLI
The command prompts for user information:
app/Console/Commands/UserCreateCommand.php:22
$name = $this->ask('Name');
$email = $this->ask('Email');
$password = $this->secret('Password');
$password_confirmation = $this->secret('Confirm password');
$admin = $this->confirm('Is this user an admin?');
Creates the user with hashed password:
app/Console/Commands/UserCreateCommand.php:40
$user = User::create([
    'name' => $name,
    'email' => $email,
    'password' => bcrypt($password),
    'admin' => $admin,
]);
Example Session:
$ php artisan user:create
Creating a new user...
Name: John Doe
Email: [email protected]
Password: ••••••••
Confirm password: ••••••••
Is this user an admin? (yes/no) [no]: yes
User with name John Doe created successfully.
Admin users have access to Laravel Pulse monitoring and the streamer management panel.

Built-in Laravel Commands

In addition to custom commands, you’ll frequently use these Laravel commands:

Database

php artisan migrate

Cache Management

php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear

Laravel Octane

php artisan octane:start

Development

php artisan tinker

Scheduled Commands

While the application doesn’t currently define scheduled tasks in app/Console/Kernel.php, you can schedule commands using Laravel’s task scheduler:
protected function schedule(Schedule $schedule): void
{
    // Generate sitemap daily at 2 AM
    $schedule->command('sitemap:generate')->dailyAt('02:00');
    
    // Purge Cloudflare cache after sitemap
    $schedule->command('cloudflare:purge')->dailyAt('02:15');
}
Then add to your crontab:
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Creating Custom Commands

Generate a new command:
php artisan make:command YourCommandName
Example command structure:
namespace App\Console\Commands;

use Illuminate\Console\Command;

class YourCommandName extends Command
{
    protected $signature = 'your:command {argument?} {--option}';
    protected $description = 'Command description';
    
    public function handle(): void
    {
        $this->info('Command output');
        // Your command logic
    }
}

Best Practices

Always add environment checks for destructive operations:
app/Console/Commands/UserCreateCommand.php:16
if (config('app.env') === 'production' && ! $this->confirm('You are in production mode. Are you sure?')) {
    return;
}
Log important command executions:
Log::info('Sitemap generated', ['total_urls' => count($urls)]);
Return appropriate exit codes:
return Command::SUCCESS;  // 0
return Command::FAILURE;  // 1
return Command::INVALID;  // 2

Next Steps

Deployment Guide

Learn how to deploy with Laravel Octane

Architecture

Understand the application structure

Build docs developers (and LLMs) love