bestit/harvest-api

使用PHP编写的Harvest API,针对Laravel进行优化。

0.1.0 2017-04-20 14:27 UTC

This package is auto-updated.

Last update: 2024-08-29 04:20:02 UTC


README

Build Status

待办事项

安装

步骤 1: Composer

在命令行中运行

composer require bestit/harvest-api

步骤 2: 服务提供者

对于您的Laravel应用,打开config/app.php文件,并在providers数组中追加

BestIt\Harvest\HarvestServiceProvider::class,

这将启动包进入Laravel。

步骤 3: 门面

对于您的Laravel应用,打开config/app.php文件,并在aliases数组中追加

'Harvest' => BestIt\Harvest\Facade\Harvest::class,

这将把Harvest门面添加到Laravel。

步骤 4: 发布配置

在命令行中运行

php artisan vendor:publish --provider="BestIt\Harvest\HarvestServiceProvider"

步骤 5: 配置

将以下条目添加到您的环境文件(.env)中

HARVEST_SERVER_URL // This is required...
HARVEST_USERNAME // This is required...
HARVEST_PASSWORD // This is required...

Laravel内使用

// Get all users.
$users = Harvest::users()->all();

// For more examples check the ./examples directory.

Laravel外使用

// Load dependencies
require_once __DIR__ . '/vendor/autoload.php';

$url = 'https://company.harvestapp.com';
$username = 'some@email.com';
$password = 'password';

$client = new \BestIt\Harvest\Client($url, $username, $password);

// Get all users.
$users = $client->users()->all();

// For more examples check the ./examples directory.

待办事项

  • 测试(可能使用mockable.io?)
  • 覆盖所有端点