added apply method and example.php