This package is abandoned and no longer maintained. No replacement package was suggested.

Library class for calculation of moon phases

dev-master 2012-11-12 14:23 UTC

This package is not auto-updated.

Last update: 2020-03-18 13:03:49 UTC


This is port in PHP of the moontool C program written by John Walker

I know nothing about planetary physics, but managed to muddle my way through the code and mostly figure out what was going on. There's a lot of static methods going on... Anyway, the times it produces are consistent with what NASA has to say so I'm happy!

I originally put it together to help decorate tide tables with the lunar phases for a client and thought it might be useful to others so here it is.

There is little inline documentation of the source - and it could do with a clean up and some extra love. I'll get around to it at some point...

If you use this utility, I'd love to know about it and hope it turns out to be useful. You can get in touch at


Get a copy of the source from BitBucket at

git clone

Install it into your project using composer.

require "netglue/moontool": "dev-master"


PHP 5.3+


Please see