Add to composer:
composer require "pmdevelopment/yubikey-otp-bundle" "dev-master"
Add to kernel:
new PM\Bundle\YubikeyOtpBundle\PMYubikeyOtpBundle(),
Add to config.yml
pm_yubikey_otp:
server:
uri: https://api2.yubico.com/wsapi/2.0/
client_id: YourClientId
client_secret: YourApiKey
Now you can validate any a OTP by using a service
$this->get("pm_yubikey_otp.validation")->verify("YourOtpToValidate", "OptionalTheIdentityYouExpect");