artarts36/head-hunter-api

HeadHunter API Client

0.3.7 2020-09-09 11:05 UTC

This package is auto-updated.

Last update: 2024-11-09 21:27:25 UTC


README

PHP Composer License: MIT Total Downloads

Description:

Client for work with API https://hh.ru

HeadHunter API Documentation: https://github.com/hhru/api

Installation:

composer require artarts36/head-hunter-api

Examples:

Simple:

use ArtARTs36\HeadHunterApi\Client;
use ArtARTs36\HeadHunterApi\Features\Vacancy\Vacancy;

$client = new Client('https://api.hh.ru', 'MyApp/my@mail.ru');
$feature = new Vacancy($client);
$vacancy = $feature->find(123456789);

var_dump($vacancy->getSpecializations());

Connect in Laravel:

1*. Set variables in .env:

HEADHUNTER_API_BASE_URL='https://api.hh.ru'
HEADHUNTER_API_USER_AGENT='MyApp/my@mail.ru'

2*. Binding in bootstrap/app.php:

$app->singleton(
    \ArtARTs36\HeadHunterApi\Contracts\Client::class,
    function () {
        return new \ArtARTs36\HeadHunterApi\Client(
              env('HEADHUNTER_API_BASE_URL'),
              env('HEADHUNTER_API_USER_AGENT')
        );
    }
);