For years I hated timesheets. I am not particularly thorough at doing them either, so it just gets worse and worse. Fear not, I think I may have found a neat solution. The idea is to track when a PHP file is executed and log which project it belongs to.
To use my script, just follow the instructions in comments, but basically you will add it as a auto_prepend_file in your php.ini and it will check if the current script is watched and to which project it belongs to.
It is using a very basic file structure without even writing content. It is simply creating folder and files so you should not see the overhead. In fact, I tested that it creates an overhead of only about 0.3ms (on a SSD).
It also has a threshold to count as continuous several minutes without activity (more details in comments).
So lets say you have this structure:
- /var/www/client-A/project-1
- /var/www/client-A/project-2
- /var/www/client-B/project-1
Well with this script, configured to watch folder /var/www, any PHP called in it would be tracked and you would end up with something like:
- 2013-01-30
- client-A
- project-1: Time: 3:30
- project-2: Time: 1:30
- client-B
- project-1: Time: 2:00
- 2013-01-31
- client-B
- project-1: Time: 8:30
Very very useful to build timesheets.
Downside
Now, of the people I have showed this, a lot have said that it tracks a too narrow portion of site development. From what I am used to, I have to disagree. Here's a breakdown of events that would be tracked:- Looking or configuring the CMS
- Testing some CSS/JS/HTML/PHP
- Testing a new plugin
- An AJAX request that runs on the page
And what would not:
- Developing a complicated library
- Documenting
- Designing
Well, I rarely design, it’s someone else who does it. Developing a complicated library? It is kinda rare, and when I do, it is linked to some project and I will end up testing it at the same time anyway. The real issue is documentation, but I tend to write it as I go. The threshold helps prevent those events won't be noticed, but in the end, the tool is meant to help, not to be an exact representation of your time.