Skip to content

Console Commands

JournalPHP uses Artisan — Laravel's standard CLI.

Running Commands

Dev environment:

bash
docker compose exec app php artisan <command>

Production:

bash
docker compose -f docker-compose.prod.yml exec app php artisan <command>

JournalPHP Commands

Located in app/Console/Commands/. Can be run manually or on a schedule via Laravel Scheduler.

Users

SignaturePurpose
users:unbanRemove temporary bans that have expired
users:purge-deletedPermanently delete soft-deleted accounts

Rating

SignaturePurpose
rating:update-place-historyRecalculate and store user rating place history

Subscriptions

SignaturePurpose
subscriptions:payments:check-pendingCheck pending payments and dispatch queue jobs
subscriptions:auto-renewRun auto-renewal cycle for subscriptions

Options for subscriptions:payments:check-pending:

OptionDefaultPurpose
--queue=subscription-paymentssubscription-paymentsQueue for background payment processing
--minutes=1010How many minutes back to look for pending payments

Content

SignaturePurpose
post-counts:refreshRecalculate denormalized post counters
topics:update-activity-scoreUpdate community activity scores (7-day window)

Media

SignaturePurpose
media:cleanup-orphaned {--limit=500}Delete media files not attached to any entity

Moderation

SignaturePurpose
moderation:comments {--sync}Run AI moderation on queued comments

Standard Laravel Commands

Database

bash
php artisan migrate --force
php artisan migrate:status
php artisan db:seed
php artisan migrate:rollback

Cache

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

Application

bash
php artisan key:generate
php artisan storage:link
php artisan about

Queues & WebSocket

bash
php artisan horizon
php artisan reverb:start
php artisan queue:work
php artisan queue:failed
php artisan queue:retry all

Search (Scout)

bash
php artisan scout:import "App\Models\Post"
php artisan scout:flush "App\Models\Post"

Interactive Shell

bash
docker compose exec app php artisan tinker

Allows running PHP code in the application context — useful for debugging and manual data operations.

List All Commands

bash
docker compose exec app php artisan list

Scheduler

Automatic command scheduling is configured in app/Console/Kernel.php. Current schedule:

CommandInterval
users:unbanhourly
rating:update-place-historyevery minute
subscriptions:payments:check-pendingevery minute
subscriptions:auto-renewhourly
users:purge-deletedhourly
media:cleanup-orphanedevery 30 minutes
topics:update-activity-scoretwice daily
moderation:commentsevery minute

For production scheduling, add a cron entry:

bash
* * * * * docker exec <container_name> php artisan schedule:run >> /dev/null 2>&1

Or via Docker:

bash
docker compose exec app php artisan schedule:run

The routes/console.php file is only used to register Artisan closure commands, not the schedule.

Released under the MIT License.