Menu

Cache Composer and npm in GitHub Actions for Laravel
📰

Cache Composer and npm in GitHub Actions for Laravel

DEV Community: laravel·devTalk·about 3 hours ago
#lkcLq8bn
#devtolaravel#devto#dev#cache#composer
Reading 0:00
15s threshold

Last updated: 12 November 2026. See the update log at the end.

Most of the time in a Laravel CI run goes to downloading packages: Composer dependencies on every run, and npm packages whenever you build front-end assets. Each run starts on a clean machine, so without a cache the same files are fetched again and again. This is Part 2 of the series. Part 1 built the test workflow; here we add caching to it, and Part 3 reuses the same steps in the deploy job.

I did not time any run, so there are no speed-up numbers here. What follows is the configuration, why each line exists, and how to confirm the cache is working in your own logs.

What to cache, and what not to

Cache the package manager's download cache , not the installed vendor directory. The setup-php README says it plainly: do not cache vendor with actions/cache , because that has side effects.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.