PHP code example of visithor / visithor-bundle

1. Go to this page and download the library: Download visithor/visithor-bundle 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/ */

    

visithor / visithor-bundle example snippets

 bash
php composer.phar update
 php
use Symfony\Component\HttpKernel\KernelInterface;
use Visithor\Bundle\Environment\Interfaces\EnvironmentBuilderInterface;

/**
 * Class EnvironmentBuilder
 */
class EnvironmentBuilder implements EnvironmentBuilderInterface
{
    /**
     * Set up environment
     *
     * @param KernelInterface $kernel Kernel
     *
     * @return $this Self object
     */
    public function setUp(KernelInterface $kernel)
    {
        //
    }

    /**
     * Tear down environment
     *
     * @param KernelInterface $kernel Kernel
     *
     * @return $this Self object
     */
    public function tearDown(KernelInterface $kernel)
    {
        //
    }

    /**
     * Get authenticated user
     *
     * @param string $role Role
     *
     * @return mixed User for authentication
     */
    public function getAuthenticationUser($role)
    {
        //
    }
}
 php
/**
 * Get authenticated user
 *
 * @param string $role Role
 *
 * @return mixed User for authentication
 */
public function getAuthenticationUser($role)
{
    return 'ROLE_ADMIN' === $role
        ? $this
            ->adminUserRepository
            ->findOneBy([
                'email' => '[email protected]'
            ])
        : null;
}