Why do you need to use other than the default?
You can just run optimize instead of poinlessly clearing caches and then caching (which clears anyway)
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, what is the best script to use in Forge? Ive seen:
cd /home/forge/app.thillow.co.uk
git pull origin $FORGE_SITE_BRANCH
$FORGE_COMPOSER install --no-dev --no-interaction --prefer-dist --optimize-autoloader
( flock -w 10 9 || exit 1
echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock
if [ -f artisan ]; then
$FORGE_PHP artisan migrate --force
fi
# clear any existing cache
php artisan view:clear
php artisan route:clear
php artisan event:clear
php artisan config:clear
php artisan auth:clear-resets
# cache everything that's possible
php artisan view:cache
php artisan route:cache
php artisan event:cache
php artisan config:cache
npm i && npm run build
$FORGE_PHP artisan horizon:terminate
Is this optimal? Thanks
Please or to participate in this conversation.