jobapis / jobs-multi
Making it easy to get jobs from multiple job boards.
Installs: 2 448
Dependents: 1
Suggesters: 0
Security: 0
Stars: 56
Watchers: 12
Forks: 21
Open Issues: 7
Requires
- php: >=5.5.0
- jobapis/jobs-careerbuilder: ^2.0.3
- jobapis/jobs-careercast: ^1.0.1
- jobapis/jobs-careerjet: ^0.1.0
- jobapis/jobs-common: ^2.1.1
- jobapis/jobs-dice: ^1.0.0
- jobapis/jobs-github: ^1.0.0
- jobapis/jobs-govt: ^1.0.0
- jobapis/jobs-ieee: ^0.1.0
- jobapis/jobs-indeed: ^1.0.0
- jobapis/jobs-jobinventory: ^0.1.0
- jobapis/jobs-jobs2careers: ^2.0.0
- jobapis/jobs-juju: ^2.0.0
- jobapis/jobs-monster: ^0.1.0
- jobapis/jobs-stackoverflow: ^0.1.0
- jobapis/jobs-usajobs: ^0.2.0
- jobapis/jobs-ziprecruiter: ^1.0.0
Requires (Dev)
- mockery/mockery: >=0.9.4
- phpunit/php-code-coverage: ~2.0
- phpunit/phpunit: >=4.6
- squizlabs/php_codesniffer: ~2.0
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$perPage
times 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:maxAge
Maximum age (in days) of listings.maxResults
Truncate the results to a certain number.order
Sort results byasc
ordesc
.orderBy
Field to order results by, eg:datePosted
.
-
getAllJobs($options)
Get a collection of jobs from all providers configured above. SeesetOptions
method 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. SeesetOptions
method 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.