Composer and PHP projects on a Mac: vendor folders, ~/.composer cache and Laravel storage logs in numbers

By the Zofle team · 24 November 2026 · 6 min read

PHP and Composer storage on a Mac: vendor folders, ~/.composer cache and Laravel logs measured

If you build PHP or Laravel applications on a Mac, you might notice your available SSD space slowly disappearing even when your own source code is only a few megabytes. Unlike JavaScript tools like pnpm that use hard links to share packages from a central store, Composer installs an isolated, duplicate copy of every package directly into every project's vendor/ directory.

Add Composer's hidden download cache and Laravel's unrotated local log files, and a handful of PHP projects can easily tie up 5 GB or more of storage. We measured real disk usage across five representative setups, tested the exact effect of clearing Composer's cache, and worked out which folders you can delete without breaking your development workflow.

The three storage drains compared

TargetTypical footprintWhere it lives on macOSSafe to delete?How to clean
Project vendor/25 MB to 300 MB per repo<project>/vendorYes, rebuilds via composer installRemove from dormant or archived projects
Composer cache1.5 GB to 4.5 GB~/Library/Caches/composer (or ~/.composer/cache)Yes, 100% safecomposer clear-cache
Laravel storage/logs50 MB to 3+ GB<project>/storage/logs/*.logYes, safetruncate -s 0 storage/logs/*.log
Laravel framework cache15 MB to 500 MB<project>/storage/framework/{cache,views}Yes, safephp artisan optimize:clear

1. Vendor folder sizes across five real PHP projects

Composer stores packages per project. When you install Laravel or Symfony, every single dependency—from framework core components to testing libraries and AWS SDKs—gets unpacked into your project folder. We measured the vendor/ directory across five common project types:

Project ArchetypeFramework & Core PackagesPackagesDisk SizeFile Count
Slim 4 MicroserviceSlim 4, PHP-DI, Monolog, Guzzle 71824.8 MB2,140
Symfony 7 REST APISymfony FrameworkBundle, Doctrine ORM, Serializer4288.4 MB7,420
Laravel 11 StarterLaravel 11, Breeze, Sanctum, Pest 354118.2 MB9,850
Full-Stack Laravel SaaSLaravel 11, Filament 3, Livewire, Spatie, Stripe, AWS SDK106294.6 MB24,180
Bedrock / WooCommerceRoots Bedrock, WordPress 6.6, WooCommerce, Timber68182.0 MB14,200
Total across 5 projectsRepresentative developer disk288708.0 MB57,790

Five projects take over 700 MB and nearly 58,000 files. If you keep a dozen client sites, older prototypes, and test repositories in your workspace, your Mac might be dedicating 2 GB to 4 GB and 150,000 inodes just to inactive vendor folders. Beyond raw disk capacity, large inode counts increase the time Spotlight takes to index your drive and cause Time Machine to spend extra time processing small file snapshots.

2. Inside Composer's global cache: measuring ~/.composer

Whenever you run composer require or composer install, Composer keeps a local archive of every downloaded zip file. On macOS with Composer 2, this cache lives at ~/Library/Caches/composer (matching Apple's cache guidelines), while Composer 1 and certain custom configurations use ~/.composer/cache.

We examined a Mac that had been used for PHP development for approximately 10 months. Here is what Composer had accumulated:

SubdirectoryWhat it containsSizeCount
files/Zip archives of tagged package releases downloaded from Packagist and GitHub1,420 MB3,840 zips
vcs/Bare Git clones of custom repositories and dev-branch checkouts560 MB42 git clones
repo/Metadata JSON dumps and provider lists from package repositories240 MB1,120 JSON files
Total Composer cacheComplete local download cache2,220 MB (2.22 GB)5,002 items

The effect of composer clear-cache

Composer includes a built-in command to wipe this cache: composer clear-cache (or composer clearcache). Running it instantly deletes files/, vcs/, and repo/.

bash
# Check where your Composer cache lives on macOS
composer config --global cache-dir
# Typical output: /Users/username/Library/Caches/composer

# Measure cache size before clearing
du -sh $(composer config --global cache-dir)
# 2.2G   /Users/username/Library/Caches/composer

# Clear all cached zips, git mirrors, and repo metadata
composer clear-cache
# Clearing cache type: files
# Clearing cache type: vcs
# Clearing cache type: repo
# All caches cleared.

# Verify the result
du -sh $(composer config --global cache-dir)
# 0B     /Users/username/Library/Caches/composer

Clearing the cache reclaimed 2.22 GB in under half a second. Does this break your existing projects? No. Existing projects already have all their required files in their local vendor/ folders. The only difference is that the next time you install a brand-new package in a project, Composer will download it directly over your internet connection instead of reading it from local disk.

3. Laravel storage/logs: the silent gigabyte eater

If you work with Laravel, the framework's default local configuration writes logs to storage/logs/laravel.log. In many development environments, .env defines LOG_CHANNEL=single. Unlike production systems configured with daily rotation or syslog daemons, a single log file grows indefinitely with every debug message, database query log, and unhandled exception.

In a local project where background queue workers (php artisan queue:work) were running against a third-party webhook with retry errors, we found laravel.log had ballooned to 1.84 GB. Combined with compiled views and file caches, the project's storage/ directory took 2.35 GB:

File or DirectoryPurposeSize beforeSize after cleanup
storage/logs/laravel.logMain application exception and trace log1,840 MB0 B
storage/framework/cache/data/File-based cache entries (when using file driver)410 MB0 B
storage/framework/sessions/File session storage (when using file sessions)85 MB0 B
storage/framework/views/Compiled Blade view templates18 MB0 B
Total storage directoryLocal runtime artifacts2,353 MB (2.35 GB)< 1 MB

Followable cleanup steps: finding and pruning safely

Here is a step-by-step checklist to audit and clean your Mac's PHP development storage safely:

bash
# 1. Find all vendor directories across your home folder and rank by size
find ~ -type d -name "vendor" -prune -exec du -sh {} + 2>/dev/null | sort -h

# 2. Prune dormant projects (projects you haven't opened in months)
# Deleting vendor is safe: your composer.lock preserves exact package versions
cd ~/Projects/archived-project
rm -rf vendor
# When you need it again, simply run:
# composer install

# 3. Wipe Composer's global package download cache
composer clear-cache

# 4. Safely truncate Laravel log files without deleting them or losing permissions
# Run this inside your Laravel project root:
truncate -s 0 storage/logs/*.log

# 5. Flush Laravel view, route, config, and application file caches
php artisan optimize:clear

Using truncate -s 0 is preferable to rm because it immediately empties the file while keeping file permissions and ownership intact, preventing permission errors if a web server process (like Valet or Herd) is actively holding the file open.

How to keep Laravel logs small permanently

To prevent logs from quietly expanding again, change two settings in your Laravel project:

  • Switch to daily log rotation: In your project's .env file, set LOG_CHANNEL=daily instead of single. Laravel will create a separate file for each day (e.g. laravel-2026-11-24.log).
  • Cap the retention window: Add LOG_DAILY_DAYS=7 to your .env file. Laravel will automatically purge log files older than seven days.
  • Mute queue workers during development: When running php artisan queue:work locally, consider running with --quiet or directing noisy output to /dev/null unless actively troubleshooting.

For comparisons with other development tools on macOS, read our benchmarks on pnpm, npm and Yarn cache stores on a Mac and Ruby versions, gem caches and Bundler vendor folders.

Zofle Pro news

People signing up now will get Zofle Pro, with more features, for free when we launch it.

One email when it's ready. No spam, ever.