add support for Ev extension (libev)

Brought https://github.com/reactphp/react/pull/178 inline with current branch.  Fixed unit tests.  added additional unit test for periodic timer.
This is to avoid segfaults that occur on PHP 5.4, 5.5.  There is some delay needed before the call to detach the time is actually made - hacky, but it does solve the issue.