So php isn’t the greatest thing ever. Nonetheless its tooling has evolved and that are a number of things you can do to make it less auful. The goal of this is to cover setting of a php project so that you can pull in dependancies and provide an easy way for users to install your software.
First, get composer as it will make dependencies much easier to manage.
That page then goes on to explain how to find and pull in packages.
The format of
composer.json is pretty simple and usually packages you
want will come with snippets you can plug right into it.