Google Authenticator with PHP not working

1.3k Views Asked by At

im trying to make use of the project https://github.com/sonata-project/GoogleAuthenticator I have first installed the project with: composer require sonata-project/google-authenticator . after this when I want to see the action I receive an error

PHP Fatal error: Interface 'Sonata\GoogleAuthenticator\GoogleAuthenticatorInterface' not found in /home/######/vendor/sonata-project/google-authenticator/src/GoogleAuthenticator.php on line 19

Am I forgetting something ?

any help would be appreciated!

2

There are 2 best solutions below

0
On

Add below line to ur GoogleAuthenticator.php file which is in src folder

include_once 'GoogleAuthenticatorInterface.php';
0
On

I presume you solved this, or got around it somehow. But the answer for me was changing

include_once __DIR__.'/src/FixedBitNotation.php';
include_once __DIR__.'/src/GoogleAuthenticator.php';
include_once __DIR__.'/src/GoogleQrUrl.php';
include_once __DIR__.'/src/FixedBitNotation.php';
include_once __DIR__.'/src/GoogleAuthenticatorInterface.php';
include_once __DIR__.'/src/GoogleAuthenticator.php';
include_once __DIR__.'/src/GoogleQrUrl.php';

that is, adding: include_once __DIR__.'/src/GoogleAuthenticatorInterface.php';