move JS backend to PHP