jobapis/jobs-multi
Composer 安装命令:
composer require jobapis/jobs-multi
包简介
Making it easy to get jobs from multiple job boards.
README 文档
README
About
JobsMulti allows you to easily retrieve job listings from multiple job boards with one library and just a few lines of code.
Each client on its own will give you more flexibility and access to all the parameters for its respective API, but this package allows you to query one or more API in a single call. See Usage section below for detailed examples.
Mission
JobApis makes job board and company data more accessible through open source software. To learn more, visit JobApis.com, or contact us at admin@jobapis.com.
Usage
Prerequisites
- PHP 5.5+
- Composer PHP package manager
Installation
Create a new directory, navigate to it, and install the Jobs Multi package with composer:
composer require jobapis/jobs-multi
Configuration
Create a new file called index.php and open it up in your favorite text editor.
Add the Composer autoload file to the top of the file:
<?php require __DIR__ . '/vendor/autoload.php';
Create an array of providers you'd like to include. Each "provider" is a job board that Jobs Multi will search for your jobs:
// Include as many or as few providers as you want. Just be sure to include any required keys. $providers = [ 'Careerbuilder' => [ 'DeveloperKey' => '<YOUR DEVELOPER KEY>', ], 'Careercast' => [], 'Careerjet' => [ 'affid' => '<YOUR AFFILIATE ID>', ], 'Dice' => [], 'Github' => [], 'Govt' => [], 'Ieee' => [], 'Indeed' => [ 'publisher' => '<YOUR PUBLISHER ID>', ], 'Jobinventory' => [], 'J2c' => [ 'id' => '<YOUR PUBLISHER ID>', 'pass' => '<YOUR PUBLISHER PASSWORD>', ], 'Juju' => [ 'partnerid' => '<YOUR PARTNER ID>', ], 'Monster' => [], 'Stackoverflow' => [], 'Usajobs' => [ 'AuthorizationKey' => '<YOUR API KEY>', ], 'Ziprecruiter' => [ 'api_key' => '<YOUR API KEY>', ], ];
Job Collection
Next, instantiate the JobsMulti client in your index.php file:
$client = new \JobApis\Jobs\Client\JobsMulti($providers);
Set the parameters for your search. These methods are documented in detail below.
$client->setKeyword('training') ->setLocation('chicago, il') ->setPage(1, 10);
You can also create an array of $options that will filter your results after they're retrieved from the providers:
$options = [ 'maxAge' => 30, // Maximum age (in days) of listings 'maxResults' => 100, // Maximum number of results 'orderBy' => 'datePosted', // Field to order results by 'order' => 'desc', // Order ('asc' or 'desc') ];
Then you can retrieve results from each provider individually or from all providers at once:
// Make queries to each individually $indeedJobs = $client->getJobsByProvider('Indeed'); // Or get an array with results from all the providers at once $jobs = $client->getAllJobs($options);
For a complete working example, see the example folder in this repository.
The getJobsByProvider and the getAllJobs method will return a Collection containing many Job objects.
Documented Methods
-
setProviders($providers)Set an array of providers you want to use with default and required parameters for each. -
setKeyword($keyword)Set the search string. For example, "software engineer" or "accountant". -
setLocation($location)Set the location string. Should be in the format "City, ST". Currently only supports US locations. For example, "Chicago, IL" or "washington, dc". -
setPage($pageNumber, $perPage)Set the page number and number of results per page for each provider. This means that if you use thegetAllJobs()method to retrieve your listings, you will get at most$perPagetimes the number of providers you choose to search. -
setOptions($options)Set options for get method. These options will be applied after all results are collected from the providers, so they function more like filters. Options include:maxAgeMaximum age (in days) of listings.maxResultsTruncate the results to a certain number.orderSort results byascordesc.orderByField to order results by, eg:datePosted.
-
getAllJobs($options)Get a collection of jobs from all providers configured above. SeesetOptionsmethod above for available options. -
getJobsByProvider($provider, $options)Get a collection of jobs from a single provider by name. The provider must be in the array of providers. SeesetOptionsmethod above for available options.
Supported APIs
This package currently supports the following API providers:
- Careerbuilder
- Careercast
- Careerjet
- Dice
- Github
- Govt
- IEEE
- Indeed
- Jobinventory
- Jobs2Careers
- Juju
- Monster
- Stack Overflow
- USAJobs
- Ziprecruiter
If you'd like to add support for another provider, please see the contributing section below.
Testing
- Clone this repository from Github.
- Install the dependencies with Composer:
$ composer install. - Run the test suite:
$ ./vendor/bin/phpunit.
Contributing
Contributions are welcomed and encouraged! Please see JobApis' contribution guidelines for details, or create an issue in Github if you have any questions.
Legal
Disclaimer
This package is not affiliated with or supported by :provider_name and we are not responsible for any use or misuse of this software.
License
This package uses the Apache 2.0 license. Please see the License File for more information.
Copyright
Copyright 2017, Karl Hughes khughes.me@gmail.com.
jobapis/jobs-multi 适用场景与选型建议
jobapis/jobs-multi 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.61k 次下载、GitHub Stars 达 56, 最近一次更新时间为 2016 年 09 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「jobs」 「api client」 「job boards」 「multiple job boards」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jobapis/jobs-multi 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jobapis/jobs-multi 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jobapis/jobs-multi 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
This module enables subscription to latest jobs by email
Mock PSR-18 HTTP client
Asynchronous MQTT client built on React
Super-simple, minimum abstraction Lever DATA API v1 wrapper in PHP with support for Laravel.
Client for Google Directions API to add interpolated points to a route consisting of given coordinates.
统计信息
- 总下载量: 2.61k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 57
- 点击次数: 12
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2016-09-11