add composer.json
refactor to lib/
fix up caching and composer.json