php-extended/php-api-endpoint-http-html-object

A library that implements the php-extended/php-api-endpoint-http-html-interface library

4.0.0 2022-05-31 08:49 UTC

README

A library that implements the php-extended/php-api-endpoint-http-html-interface library.

coverage build status

Installation

The installation of this library is made via composer. Download composer.phar from their website. Then add to your composer.html :

	"require": {
		...
		"php-extended/php-api-endpoint-http-html-object": "^3"
		...
	}

Then run php composer.phar update to install this library. The autoloading of all classes of this library is made through composer's autoloader.

Basic Usage

This library is made to be extended. The HttpEndpoint implementation is a generic object that is made to ease the transform into a really useful endpoint that may be something like :


use PhpExtended\Endpoint\HttpHtmlEndpoint;

class MyEndpoint extends HttpHtmlEndpoint
{
	
	public function getFoo() : Foo
	{
		$data = $this->htmlGet('https://example.com');
		
		$id = $this->cssSelectOne('#id')->getText();
		$value = $this->cssSelectOne('#value')->getText();
		
		return new Foo($id, $value);
	}
	
}

License

MIT (See license file).