PHP code example of shield-wall / simple-authenticator

1. Go to this page and download the library: Download shield-wall/simple-authenticator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shield-wall / simple-authenticator example snippets


//YourController.php
public function yourAction()
{
        $simpleAuthenticatorForm = $this->createForm(SimpleAuthenticatorType::class, null, [
            'action' => $this->generateUrl('simple_authenticator_login'),
        ]);
        $simpleAuthenticatorFromView = $simpleAuthenticatorForm->createView();

        return $this->render('your_template.html.twig', [
            'simpleAuthenticatorFrom' => $simpleAuthenticatorFromView,
        ]);
}

//your_file.html.twig
{{ form(simpleAuthenticatorFrom) }}

//src/Repository/UserRepository.php
class UserRepository extends ServiceEntityRepository implements EmailRepositoryInterface
{
    public function findOneByEmail(string $email): UserInterface
    {
        return $this->findOneBy(['email' => $email]);
    }
}