liesauer / ql-plugin-simpleform
QueryList Plugin - SimpleForm
v4.0.1
2017-10-03 04:33 UTC
Requires
- jaeger/querylist: ^4.0.0
- jaeger/querylist-absolute-url: ^4.0.0
This package is auto-updated.
Last update: 2025-03-05 20:43:03 UTC
README
make form submission easier
Installation
composer require liesauer/ql-plugin-simpleform
Bind
- QueryList
simpleForm
($formUrl, $formSelector = '', $formParams = [], $postParams = [], ...$args)formUrl
where to get the formformSelector
only required if there are two or more form elementsformParams
use for get the form, readQueryList::get
orQueryList::post
, default method is getpostParams
same asformParams
but use for form submission, default method is postargs
no used
Usage
use liesauer\QLPlugin\SimpleForm; use QL\QueryList; require_once __DIR__ . '/vendor/autoload.php'; // cookie needed for this example $cookie = new \GuzzleHttp\Cookie\CookieJar(); $ql = QueryList::getInstance(); // use this plugin $ql->use(SimpleForm::class); $username = $ql->simpleForm('https://github.com/login', '', [ 'options' => [ 'verify' => false, 'cookies' => $cookie, ], ], [ 'params' => [ 'login' => 'username', 'password' => 'password', ], 'options' => [ 'verify' => false, 'cookies' => $cookie, ], ])->find('.header-nav-current-user>.css-truncate-target')->text(); if (!empty($username)) { echo "welcome back, {$username}!\n"; } else { $error = $ql->find('.flash-error>.container')->text(); echo "{$error}\n"; }