/jobs-multi

Making it easy to get jobs from multiple job boards

Primary LanguagePHP

JobApis.com Jobs Multi

Twitter URL Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

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

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 the getAllJobs() 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 by asc or desc.
    • orderBy Field to order results by, eg: datePosted.
  • getAllJobs($options) Get a collection of jobs from all providers configured above. See setOptions 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. See setOptions method above for available options.

Supported APIs

This package currently supports the following API providers:

If you'd like to add support for another provider, please see the contributing section below.

Testing

  1. Clone this repository from Github.
  2. Install the dependencies with Composer: $ composer install.
  3. 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.