Flag_entity is a project mainly written in PHP, it's free.
Drupal's module, extend module flag to flag any entity.