chore(composer): pull version from composer.json

Replaces #6766

Added error handling and apparently missing file_get_contents call.

TODOs:
* [x] Don't move `$version` definition to composer