LaravelPackages.net
Acme Inc.
Toggle sidebar
novatorgroup/service1c

Component for executing requests to HTTP Services 1C

230
0
1.2.5
About novatorgroup/service1c

novatorgroup/service1c is a Laravel package for component for executing requests to http services 1c . It currently has 0 GitHub stars and 230 downloads on Packagist (latest version 1.2.5). Install it with composer require novatorgroup/service1c. Discover more Laravel packages by novatorgroup or browse all Laravel packages to compare alternatives.

Last updated

HTTP Service 1C

Component for executing requests to HTTP Services 1C

Installation

The preferred way to install this extension is through composer. Either run

php composer.phar require --prefer-dist novatorgroup/service1c "*"

or add

"novatorgroup/service1c": "*"

to the require section of your composer.json file.

Usage

    $service = new \novatorgroup\service1c\HttpService([
        'host' => 'http://host.com', //required
        'base' => 'base', //required
        'login' => 'login',
        'password' => 'password',
        'curlOptions' => [
            CURLOPT_CONNECTTIMEOUT_MS => 200,
            CURLOPT_TIMEOUT_MS => 1000,
        ]
    ]);

    // GET
    // Request to: // http://host.com/base/hs/command/param?key=value
    
    $response = $service->get('command', ['param', 'key' => 'value']);

    if ($response->isOk()) {
        echo $response->code;
        echo $response->error;
        echo $response->result;
        echo $response->getHeader('Content-Length');
    }
    
    // POST
    // the body will be sent in JSON format
    $response = $service->post('command', ['param' => 'value1', 'param2' => ['a', 'b']]);
    
    // JSON
    {
        "param": "value1",
        "param2": [
            "a",
            "b"
        ]    
    }
    
Comments