Batch install dependencies in all subfolder-organised projects

As a lecturer ICT I have to correct the work our students make. Therefor I collect all solutions and put them in a subfolder-organised structure on disk: per student I create a subfolder and put their solution into that folder(*).

$ tree -L 1
├── student1
├── student2
├── ...
└── studentN

As – from the 2nd year on – most of our projects use some sort of dependency manager I often found myself manually cding into folders and running the command to install the dependencies.

Today I knocked up a one-liner to install all PHP dependencies (using Composer) in subfolder-organised projects. My first attempt was pretty awful, yet with a hint by Frank I eventually cleaned it up:

find . -name composer.json -maxdepth 2 -execdir composer install \;

With some minor modifications the command can also be used to installing dependencies using npm:

find . -name package.json -maxdepth 2 -execdir npm install \;

(*) actually, a handy app created by a colleague of mine bash script I wrote does this automatically for me, but that’s not the gist of this post

Did this help you out? Like what you see?
Consider donating.

I don’t run ads on my blog nor do I do this for profit. A donation however would always put a smile on my face though. Thanks!

☕️ Buy me a Coffee ($3)

CocoaPods Tech Talk Video

Great tech talk by the folks over at Ray Wenderlich on CocaoPods, the dependency manager for Objective-C. Be sure to click through on the link below as the original article contains a truckload of useful links.

CocoaPods Tech Talk Video →
Source Code used in the talk (.zip) →
CocoaPods →

Composer – Dependency Manager for PHP

Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs and it will install them in your project for you.

Think npm install but then for PHP

    "require": {
        "monolog/monolog": "1.2.*"
$ composer install

Plays nice with packages that support PSR-0 autoloading. Packages can be found on

Composer →