I'm using PhpStorm to manage many of my client Laravel PHP projects, however as these projects have become larger it's become important to maintain and also show version information inside the system I'm developing.
To do this I'm using the
PhpStorm does not have such functionality (including other IDEA-based IDEs). There are some tickets asking for such functionality .. but it will definitely not work for your scenario (the use case there is different).
You will have to do it "manually". By this I mean:
Such script will open your
.env file, find the right line and edit the value there -- little bit of file parsing job -- nothing super heavy.
Hint: Laravel has
artisan .. and one of the commands is
key:generate (which alters
.env file -- at very least it is run at very least once when you create new Laravel app). You may do it in similar fashion -- do your script as artisan command (so that you have full Laravel power behind it) and just call it when needed (File Watcher or whatever).
P.S. Instead of editing
.env file (which is more environment specific rather than global setting, which version info is) .. why not store this in custom config file (e.g.
config/version.php) which will contain that info only and therefore will be much easier to alter or even generate from scratch (template) as it has much simple structure and therefore no need to maintain other existing info there (which you have to do with
At the end of the day -- there is no big difference for you/programmers between calling
config('version.app_version') to get that info in your app.