src/Wallhaven/Wallhaven.php
public function login($username, $password)
    {
        if (empty($username) || empty($password)) {
            throw new LoginException("Incorrect username or password.");
        }

        $this->initClient(true);

        $login = $this->client->post(self::URL_LOGIN, [
            'form_params' => [
                '_token'   => $this->getToken(),
                'username' => $username,
                'password' => $password
            ],
            'on_stats' => function (TransferStats $stats) use (&$url) {
                $url = $stats->getEffectiveUri();
            }
        ]);

        if ($url == self::URL_HOME . self::URL_LOGIN) {
            throw new LoginException("Incorrect username or password.");
        }

        $this->username = $username;
    }
public function login($username, $password)
    {
        if (empty($username) || empty($password)) {
            throw new LoginException("Incorrect username or password.");
        }

        $this->initClient(true);

        $login = $this->client->post(self::URL_LOGIN, [
            'form_params' => [
                '_token'   => $this->getToken(),
                'username' => $username,
                'password' => $password
            ],
            'on_stats' => function (TransferStats $stats) use (&$url) {
                $url = $stats->getEffectiveUri();
            }
        ]);

        if ($url == self::URL_HOME . self::URL_LOGIN) {
            throw new LoginException("Incorrect username or password.");
        }

        $this->username = $username;
    }
Login to Wallhaven.

@param string $username Username.
@param string $password Password.

@throws LoginException