muan / universal-parser
Universal Parser in php
1.3
2018-11-21 12:19 UTC
Requires
- guzzlehttp/guzzle: ^6.3
- symfony/css-selector: ^4.1
- symfony/dom-crawler: ^4.1
This package is not auto-updated.
Last update: 2024-04-28 03:46:38 UTC
README
Universal interface for make concrete parser in php.
Requirements
- PHP >=7.1
Install
composer require muan/universal-parser
Usage
Create HttpClientAdapter or make your own adapter by implementing interface HttpClientAdapterInterface.
$httpClientAdapter = new \UniversalParser\HttpClientAdapter();
Make array with parsers. You can create your own parsers by implementing ParserInterface.
$parsers = [ 'title' => \UniversalParser\Parsers\TitleParser::class, ];
Create Universal Parser
$universalParser = new \UniversalParser\UniversalParser($httpClientAdapter, $parsers);
and parse url
$url = 'https://laravel.com/docs/5.7/contributions'; $data = $universalParser->getData($url);
License
Universal Parser package is licensed under the MIT License.