seregazhuk/headhunter-api
Composer 安装命令:
composer require seregazhuk/headhunter-api
包简介
PHP library to interact with hh.ru API
关键字:
README 文档
README
Provides a friendly API interface for HeadHunter (hh.ru) service.
Official API docs available here.
- Installation
- Quick Start
- Vacancies
- Employers
- Employer Managers
- Artifacts
- User
- Comments
- Industries
- Negotiations
- Regions
- Resumes
- Saved searches
- Specializations
- Dictionaries
- Suggests
- Metro
- Languages
- Custom requests
Dependencies
Requires PHP 5.6 or above.
Installation
The recommended way to install this library is via Composer. New to Composer?
composer require seregazhuk/headhunter-api
Quick Start
// You may need to amend this path to locate composer's autoloader require('vendor/autoload.php'); use seregazhuk\HeadHunterApi\Api; /** * Token is optional. Your need token only * for resources that require authentication */ $api = Api::create('YOUR_TOKEN'); $userInfo = $api->me->info();
You can create an instance without token, and later change it.
$api = Api::create();
$api->setToken('YOUR_TOKEN');
API Resources
Vacancies
View vacancy by id (official docs):
$vacancy = $api->vacancies->view($id);
Get similar vacancies for the current one (official docs):
$similarVacancies = $api->vacancies->similar($id);
Get black listed vacancies (official docs):
$blacklisted = $api->vacancies->blacklisted();
Get list of favorited vacancies (official docs):
$vacancies = $api->vacancies->favorited(); // with pagination $vacancies = $api->vacancies->favorited(['page' => 2]);
Search (official docs):
$vacancies = $api->vacancies->search($params);
Vacancy statistics (official docs):
$stats = $api->vacancies->statistics($vacancyId);
Employer's active vacancies (official docs):
$vacancies = $api->vacancies->active(); // you can specify a manager, by default uses current manager $vacancies = $api->vacancies->active($managerId); // with pagination $vacancies = $api->vacancies->active($managerId, ['page'=>2]);
Employer's archived vacancies (official docs):
$archived = $api->vacancies->archived(); // with pagination $archived = $api->vacancies->archived(['page'=>2]);
Employer's hidden vacancies (official docs):
$hidden = $api->vacancies->hidden(); // with pagination $hidden = $api->vacancies->hidden(['page'=>2]);
Hide a vacancy (official docs):
$api->vacancies->hide($vacancyId);
Restore a vacancy (official docs):
$api->vacancies->restore($vacancyId);
Employers
View employee by id (official docs):
$employee = $api->employers->view($id);
Search (official docs):
$employers = $api->employers->search($params);
Employer Managers
Reference types and the rights of the manager (official docs):
$reference_type = $api->employers->getManagerTypes(); $reference_type = $api->employers->getManagerTypes($employerId);
When used without parameters your employer id will be automatically resolved from your profile
Get employer managers (official docs):
$managers = $api->employers->getManagers(); $managers = $api->employers->getManagers($employerId); $managerWhoHasVacancies = $api->employers->getManagersWhoHasVacancies(); $managerWhoHasVacancies = $api->employers->getManagersWhoHasVacancies($employerId);
When used without parameters your employer id will be automatically resolved from your profile
Get manager information (official docs):
$managers = $api->employers->getManager($managerId); $managers = $api->employers->getManager($managerId, $employerId);
When used without parameters your employer id will be automatically resolved from your profile
Artifacts:
Get your photos (official docs):
$photos = $api->artifacts->photos();
Get your portfolio (official docs):
$portfolio = $api->artifacts->portfolio();
Delete photo by id (official docs):
$api->artifacts->deletePhoto($photoId);
Edit photo attributes (official docs):
$api->artifacts->editPhoto($photoId, $attributes);
Upload photo (official docs):
$api->artifacts->uploadPhoto('photo.jpg', 'my picture description');
Upload portfolio (official docs):
$api->artifacts->uploadPortfolio('portfolio.jpg', 'my portfolio description');
User:
Get current user info (official docs):
$info = $api->me->info();
Update name(last, first, middle). All parameters are required (official docs):
$api->me->editName($lastName, $firstName, $middleName);
Update flag 'is_in_search' (official docs):
$isInSearch = true; // or false; $api->me->setIsInSearch($isInSearch);
Manager preferences by managerId. You can get your manager id from user object,
returned from $api->me->info(). When used without parameters your manager id will be
automatically resolved from your profile (official docs).
$me = $api->me->info(); $managerId = $me['manager']['id']; $preferences = $api->manager->preferences($managerId); // automatically get manager id from your profile $preferences = $api->manager->preferences($managerId);
Applicant comments
Get all comments about applicant (official docs):
$comments = $api->comments->view($applicantId);
Create a comment (official docs). You need an applicant id, to create a comment. Applicant id can be received from resume:
$resumeInfo = $api->resume->view($resumeId); $applicantCommentsUrl = $resumeInfo['owner']['comments']['url']; // https://api.hh.ru/applicant_comments/2743747 // You need to parse id from this url // Create a comment, that is visible for coworkers $result = $api->comments($applicantId, 'my comment'); // Create a comment, that is visible only for you $result = $api->createPrivate($applicantId, 'my comment');
Edit comment (official docs):
// Edit a comment, that is visible for coworkers $api->comments->edit($applicantId, $commentId, 'new comment text') // Edit a comment, that is visible only for you $result = $api->editPrivate($applicantId, $commentId, 'new comment text');
Delete a comment (official docs):
$api->comments->delete($applicantId, $commentId);
Industries
Get all industries (official docs):
$industries = $api->industries->all();
Employee Negotiations
Get all negotiations (official docs):
$negotiations = $api->negotiations->all();
Get only active negotiations (official docs):
$negotiations = $api->negotiations->active();
View the list of messages.
- For employee: get messages of negotiation (official docs):
- For employer: view the list of messages in the response/invitation (official docs):
$api->negotiations->messages($negotiationId); // with pagination $api->negotiations->messages($negotiationId, ['page'=>2]);
Sending new message.
- For employee: create a new message (official docs):
- For employer: sending a message in the response/invitation (official docs):
$api->negotiations->message($negotiationId, $messageText);
Git list of responses/invitation for (official docs):
$responses = $api->negotiations->invited($vacancyId);
There are several types of invitations. For each of them you can pass a pagination array as a second argument:
Response
$responses = $api->negotiations->invitedResponses($vacancyId); // with pagination $responses = $api->negotiations->invitedResponses($vacancyId, ['page'=>2]);
Consider
$toConsider = $api->negotiations->invitedConsider($vacancyId);
Phone interview
$phoneInterviews = $api->negotiations->invitedPhoneInterviews($vacancyId);
Assessments
$assessments = $api->negotiations->invitedAssessments($vacancyId);
Interviews
$interviews = $api->negotiations->invitedInterviews($vacancyId);
Offers
$offers = $api->negotiations->invitedOffers($vacancyId);
Hired
$hired = $api->negotiations->invitedHired($vacancyId);
Discard by employer
$discard = $api->negotiations->invitedDiscardByEmployer($vacancyId);
View the response/invitation by id. NegotiationId can be taken from key url in the invited call response.
(official docs):
$response = $api->negotiations->view($negotiationId);
Regions
Get all regions (official docs):
$regions = $api->regions->all();
Resumes
Get my resumes (official docs):
$resumes = $api->resumes->mine();
View resume (official docs):
$views = $api->resumes->view($resumeId);
Edit resume (official docs):
$api->resumes->edit($resumeId, ['first_name' => 'New name']);
Create a new resume (official docs):
$attributes = ['first_name' => 'New name']; $result = $api->resumes->create($attributes);
Views history (official docs):
$views = $api->resumes->views($resumeId); // with pagination $views = $api->resumes->views($resumeId, ['page'=>2]);
Negotiations history (official docs):
$negotiations = $api->resumes->negotiations($resumeId); // with pagination $negotiations = $api->resumes->negotiations($resumeId, ['page' => 2]);
Update resume publish date (official docs):
$api->resumes->publish($resumeId);
Get resume conditions (official docs):
$conditions = $api->resumes->conditions($resumeId);
Remove resume (official docs):
$api->resumes->delete($resumeId);
Get current status (if it is blocked or ready to publish) (official docs):
$status = $api->resumes->status($resumeId);
Get jobs recommendations for resume (official docs):
$jobs = $api->resumes->jobs($resumeId) // with pagination $jobs = $api->resumes->jobs($resumeId, ['page' => 2])
Resume visibility
Get resume black/white list:
$blackList = $api->resumes->getBlackList($resumeId); // ... $whiteList = $api->resumes->getWhiteList($resumeId);
Add a company to black/white list:
$api->resumes->addToBlackList($resumeId, $companyId); // ... $api->resumes->addToWhiteList($resumeId, $companyId);
Remove a company from black/white list:
$api->resumes->removeFromBlackList($resumeId, $companyId); // ... $api->resumes->removeFromWhiteList($resumeId, $companyId);
Clear black/white list:
$api->resumes->clearBlackList($resumeId); // ... $api->resumes->clearWhiteList($resumeId);
Search in black/white list:
$companies = $api->resumes->searchInBlackList($resumeId, 'some-key-word'); //... $companies = $api->resumes->searchInWhiteList($resumeId, 'some-key-word');
Search in black/white list:
Saved searches:
List searches (official docs):
$searches = $api->savedSearches->all();
Get one search (official docs):
$searches = $api->savedSearches->view($searchId);
Specializations
Get all specializations (official docs):
$specializations = $api->specializations->all();
Dictionaries
Get list of entities that are used in API (official docs):
$dictionaries = $api->dictionaries->all();
Suggests
Educational institutions (official docs):
$suggests = $api->suggests->educational_institutions($text);
Companies (official docs):
$suggests = $api->suggests->companies($text);
Specialization (official docs):
$suggests = $api->suggests->fieldsOfStudy($text);
Key skills (official docs):
$suggests = $api->suggests->skillSet($text);
Position (official docs):
$suggests = $api->suggests->positions($text);
Region (official docs):
$suggests = $api->suggests->areas($text);
Tips for vacancy search key words (official docs):
$suggests = $api->suggests->vacancySearchKeyword($text);
Metro
Obtaining all metro stations of all cities (official docs):
$stations = $api->metro->all();
List of metro stations and lines in a specific city (official docs):
$stations = $api->metro->forCity($cityId);
Languages
Obtaining available languages (official docs):
$languages = $api->languages->all();
Faculties
Get list of faculties of the educational institutions (official docs). Uses institutionId that can be obtained from the suggestions for educational institutions.
$faculties = $api->faculties->forInstitution($institutionId);
Custom requests (official docs):
Locale
You can set a locale for your requests, the results will be returned in the selected locale. RU is set by
default (official docs):
$api->setLocale('EN'); // chain methods $api->setLocale('EN') ->me ->info();
Host
Get data from different websites of the HeadHunter group. (official docs):
$api->setHost('hh.kz'); // chain methods $api->setHost('hh.kz') ->me ->info();
seregazhuk/headhunter-api 适用场景与选型建议
seregazhuk/headhunter-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14.16k 次下载、GitHub Stars 达 26, 最近一次更新时间为 2016 年 01 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「api」 「hh」 「headhunter」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 seregazhuk/headhunter-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 seregazhuk/headhunter-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 seregazhuk/headhunter-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
HeadHunter.ru OAuth 2.0 Client Provider for The PHP League OAuth2-Client
A PSR-7 compatible library for making CRUD API endpoints
PHP library to interact with hh.ru API
Alfabank REST API integration
PHP library to interact with hh.ru API
PHP library to interact with hh.ru API
统计信息
- 总下载量: 14.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 26
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Mit
- 更新时间: 2016-01-09