# Managing Laravel Composer Dependencies and SSH Artisan Commands

https://bihostnet.com/en/knowledgebase/article/laravel-composer-artisan-ssh-management

## Production Composer Optimization

Always run Composer in production mode to bypass developer dependencies and build optimized class maps:

```
composer install --no-dev --optimize-autoloader
```

## Essential Artisan Commands

- `php artisan migrate --force`: Executes database migrations safely in production.
- `php artisan config:cache`: Compiles configuration into a cached file.
- `php artisan route:cache`: Pre-compiles all registered routes.
- `php artisan view:cache`: Compiles Blade templates for instant rendering.
- `php artisan optimize:clear`: Flushes all configuration, route, and compiled caches.

## Resolving Memory Exhaustion

If Composer runs out of memory on large dependency trees, run with unbounded memory: `php -d memory_limit=-1 $(which composer) install`
