Useful Snippets

Welcome!


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

Are your smart devices spying on you? Make better purchasing choices and find products that respect your privacy at Unwanted.cloud

RSS Latest posts from my personal blog


Subscribe to RSS feed


See the required PHP version for all your Composer dependencies

Stanislav KhromovStanislav Khromov

After building a project using Composer, you might ask yourself what the lowest supported PHP version amongst all the included libraries is. The highest number would also be the the minimum version PHP version that the project would run on.

To quickly check this in composer, run this from the project root:

composer show -i -t | grep -o "\-\-\(ext-\|php\).\+" | sort | uniq | cut -d- -f3-

Your output might look something like this:

php >=5.3.0
php >=5.3.9
php ^5.5 || ^7.0
php >=5.5.9

By checking the list of versions, we can see that 5.5.9 would be the lowest PHP version we would need to run this project.

Snippet source

Full-stack impostor syndrome sufferer & Software Engineer at Schibsted Media Group

Comments 0
There are currently no comments.