jordanandree / jazz-api
Jazz (Resumator) API PHP 包装器
0.4.0
2015-11-10 00:07 UTC
Requires
- php: >=5.2.0
- ext-curl: *
- ext-json: *
Requires (Dev)
- phpunit/phpunit: 3.7.*
README
PHP API 包装器,用于 Jazz API。
用法
查看 示例 以获取样本职位列表实现。
最小示例
require "jazz-api/lib/jazz.php"; // setup with your API Key $jazz = new Jazz("YOUR_API_KEY"); // return all Jobs $jobs = $jazz->getJobs(); // return all Jobs without caching $jobs = $resumator->getJobs(); // get a single Job $job = $jazz->getJob($jobs[0]->id); // create a job $job_fields = array( "title" => "New Job", "hiring_lead_id" => "YOUR_ID", "description" => "Join us!", "job_status" => 2 // draft status ); $new_job = $jazz->postJob($job_fields);
缓存
在执行任何 API 调用之前,可以配置和切换缓存机制的开/关。设计上,缓存仅适用于 GET API 调用。
示例
require "jazz-api/lib/jazz.php"; // setup with your API Key $jazz = new Jazz("YOUR_API_KEY"); // set the default caching cache file expiration time (in seconds) $jazz->cache['EXPIRES'] = 604800; // 1 week // set the cache file save path $jazz->cache['PATH'] = __DIR__ . DIRECTORY_SEPARATOR . "cache" . DIRECTORY_SEPARATOR; // disable caching $jazz->cache['ENABLED'] = false; // enable caching $jazz->cache['ENABLED'] = true;
Composer
- 将
jordanandree/jazz-api
:@stable
添加到 composer.json 的 require 部分。 - 运行
composer install
。 - 示例将如下所示
if (($loader = require_once __DIR__ . '/vendor/autoload.php') == null) { die('Vendor directory not found, Please run composer install.'); } $jazz = new Jazz("YOUR_API_KEY");
测试
测试正在进行中,覆盖率可能更好。
您可以像这样运行测试
phpunit tests/tests.php
贡献
- 分叉它 ( http://github.com/jordanandree/jazz-api-php/fork )
- 创建您的功能分支 (
git checkout -b my-new-feature
) - 提交您的更改 (
git commit -am 'Add some feature'
) - 推送到分支 (
git push origin my-new-feature
) - 创建新的 Pull Request