https://github.com/ahmard/reactphp-querylist
This library brought ReactPHP and QueryList together
https://github.com/ahmard/reactphp-querylist
php-async php-async-scrapper php-scraper querylist reactphp reactphp-http
Last synced: about 1 month ago
JSON representation
This library brought ReactPHP and QueryList together
- Host: GitHub
- URL: https://github.com/ahmard/reactphp-querylist
- Owner: Ahmard
- Created: 2021-10-05T22:18:44.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T02:43:21.000Z (over 2 years ago)
- Last Synced: 2025-02-18T05:04:44.109Z (2 months ago)
- Topics: php-async, php-async-scrapper, php-scraper, querylist, reactphp, reactphp-http
- Language: PHP
- Homepage:
- Size: 3.91 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ReactPHP QueryList
This library brought [ReactPHP](https://github.com/reactphp/http) and [QueryList](https://github.com/jae-jae/QueryList)
together.## Installation
```
composer require ahmard/reactphp-querylist
```## Usage
- Playing with **QueryList**(scraping)
```php
use ReactphpQuerylist\Client;
use ReactphpQuerylist\Queryable;require 'vendor/autoload.php';
Client::get('https://google.com')
->then(function (Queryable $queryable){
$title = $queryable->queryList()->find('head title')->text();
var_dump($title);
})
->otherwise(function ($error){
echo $error;
});
```- Working with response object
```php
use ReactphpQuerylist\Client;
use ReactphpQuerylist\Queryable;require 'vendor/autoload.php';
Client::get('https://google.com')
->then(function (Queryable $queryable){
var_dump($queryable->response()->getReasonPhrase());
})
->otherwise(function ($error){
echo $error;
});
```