2017 © Pedro Peláez
 

library curl-parser

Parser for cURL command line

image

frizz925/curl-parser

Parser for cURL command line

  • Saturday, May 5, 2018
  • by Frizz925
  • Repository
  • 2 Watchers
  • 1 Stars
  • 411 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 5 Versions
  • 122 % Grown

The README.md

Build Status codecov Latest Stable Version Total Downloads License, (*1)

cURL Parser

cURL command line parser for PHP, (*2)

Installation

Install using composer, (*3)

composer require frizz925/curl-parser

Usage

<?php


require_once(__DIR__.'/vendor/autoload.php');
$curl = <<<EOF
curl 'https://api.github.com/' -H 'Pragma: no-cache' -H 'DNT: 1' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.9' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' --compressed
EOF;
$parsed = CurlParser\Parser::parse($curl);
$uri = $parsed->getUri();
echo $uri;
// 'https://api.github.com/'
echo $uri instanceof Psr\Http\Message\UriInterface;
// true
echo $uri->getHost();
// 'api.github.com'

echo $parsed->getMethod();
// 'GET'
echo $parsed->getBody();
// ''
var_dump($parsed->getHeaders());
// ['Accept-Encoding' => ['gzip', 'deflate', 'br'], DNT' => ['1'], ...]

$req = $parsed->toRequest();
echo $req instanceof Psr\Http\Message\RequestInterface;
// true

The Versions

05/05 2018

dev-master

9999999-dev

Parser for cURL command line

  Sources   Download

MIT

The Requires

 

The Development Requires

by Izra Faturrahman

02/05 2018

1.0.3

1.0.3.0

Parser for cURL command line

  Sources   Download

MIT

The Requires

 

The Development Requires

by Izra Faturrahman

02/05 2018

1.0.2

1.0.2.0

Parser for cURL command line

  Sources   Download

MIT

The Requires

 

The Development Requires

by Izra Faturrahman

02/05 2018

1.0.1

1.0.1.0

Parser for cURL command line

  Sources   Download

MIT

The Requires

 

The Development Requires

by Izra Faturrahman

16/04 2018

1.0.0

1.0.0.0

Parser for cURL command line

  Sources   Download

MIT

The Requires

 

The Development Requires

by Izra Faturrahman