You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This package provides [Government Jobs API](http://search.digitalgov.gov/developer/jobs.html)
11
-
support for the JobBrander's [Jobs Client](https://github.com/JobBrander/jobs-common).
11
+
support for the [Jobs Common Project](https://github.com/jobapis/jobs-common).
12
12
13
13
## Installation
14
14
15
15
To install, use composer:
16
16
17
17
```
18
-
composer require jobbrander/jobs-govt
18
+
composer require jobapis/jobs-govt
19
19
```
20
20
21
21
## Usage
22
22
23
-
Usage is the same as Job Branders's Jobs Client, using `\JobBrander\Jobs\Client\Provider\Govt`
24
-
as the provider.
23
+
Create a Query object and add all the parameters you'd like via the constructor.
24
+
25
+
```php
26
+
// Add parameters to the query via the constructor
27
+
$query = new JobApis\Jobs\Client\Queries\GovtQuery([
28
+
'hl' => '1'
29
+
]);
30
+
```
31
+
32
+
Or via the "set" method. All of the parameters documented in the API's documentation can be added.
25
33
26
34
```php
27
-
$client = new JobBrander\Jobs\Client\Provider\Govt();
28
-
29
-
// Search for 200 job listings for 'project manager' in Chicago, IL
30
-
$jobs = $client
31
-
// API parameters
32
-
->setQuery() // Attempts to extract as much "signal" as possible from the input text. Handles word variants, so a search on "nursing jobs" will find a job titled "nurse practitioner" and "RN." When parts of the query parameter are used to search against the position title, the results are ordered by relevance. When no query parameter is specified, they are ordered by date with the most recent listed first.
33
-
->setOrganizationIds() // A comma-separated string specifying which federal, state, or local agencies to use as a filter.
34
-
->setHl() // No highlighting is included by default. Use 'hl=1' to highlight terms in the position title that match terms in the user's search.
35
-
->setSize() // Specifies how many results are returned (up to 100 at a time).
36
-
->setFrom() // Specifies the starting record.
37
-
->setTags() // A comma-separated string specifying the level of government. Current tags are federal, state, county, and city.
38
-
->setLatLon() // Comma-separated pair denoting the position of the searcher looking for a job. For example, 'lat_lon=37.783333,-122.416667' is the value for San Francisco, CA.
39
-
// Jobbrander parameters
40
-
->setKeyword('project manager') // See "setQuery()" method above
41
-
->setCount(100) // See "setSize()" method above
42
-
->getJobs();
35
+
// Add parameters via the set() method
36
+
$query->set('query', 'engineering');
43
37
```
44
38
45
-
The `getJobs` method will return a [Collection](https://github.com/JobBrander/jobs-common/blob/master/src/Collection.php) of [Job](https://github.com/JobBrander/jobs-common/blob/master/src/Job.php) objects.
39
+
You can even chain them if you'd like.
40
+
41
+
```php
42
+
// Add parameters via the set() method
43
+
$query->set('size', '100')
44
+
->set('from', '200');
45
+
```
46
46
47
-
### Location Queries
47
+
*Note: The government jobs API doesn't support adding location as a parameter, but their keyword or lat_lon parameters can be used for this purpose.*
48
48
49
-
Because this API does not support location-based queries, you will need to add the location
50
-
to your setKeyword() method call. For example:
49
+
Then inject the query object into the provider.
51
50
51
+
```php
52
+
// Instantiating provider with a query object
53
+
$client = new JobApis\Jobs\Client\Provider\GovtProvider($query);
52
54
```
53
-
$jobs = $client->setKeyword('project manager in chicago, il')->getJobs();
55
+
56
+
And call the "getJobs" method to retrieve results.
57
+
58
+
```php
59
+
// Get a Collection of Jobs
60
+
$jobs = $client->getJobs();
54
61
```
55
62
63
+
This will return a [Collection](https://github.com/jobapis/jobs-common/blob/master/src/Collection.php) of [Job](https://github.com/jobapis/jobs-common/blob/master/src/Job.php) objects.
64
+
56
65
## Testing
57
66
58
67
```bash
@@ -61,14 +70,14 @@ $ ./vendor/bin/phpunit
61
70
62
71
## Contributing
63
72
64
-
Please see [CONTRIBUTING](https://github.com/jobbrander/jobs-govt/blob/master/CONTRIBUTING.md) for details.
73
+
Please see [CONTRIBUTING](https://github.com/jobapis/jobs-govt/blob/master/CONTRIBUTING.md) for details.
0 commit comments