willvincent/laravel-workfront

为Laravel 5.x提供Workfront API操作

1.0.0 2016-04-06 06:06 UTC

This package is auto-updated.

Last update: 2024-09-21 20:36:04 UTC


README

使用Laravel 5.x执行WorkFront API的所有操作

安装

要获取laravel-workfront的最新版本,只需将以下行添加到您的composer.json文件的require块中

"willvincent/laravel-workfront": "dev-master"

然后,您需要运行composer installcomposer update以下载它并更新自动加载器。

将服务提供者添加到您的laravel项目后,您需要找到config/app.php文件中的providers键并注册服务提供者

'providers' => [
    // ...

    willvincent\Workfront\WorkfrontServiceProvider::class,
],

同样,在您的config/app.php文件中找到Aliases键并注册外观

'aliases' => [
    // ...

    'Workfront' => willvincent\Workfront\Facades\WorkfrontFacade::class,
],

最后,运行php artisan vendor:publish将默认配置复制到您的应用程序配置目录。用您的有效凭据更新配置。

用法

$client = Workfront::client();
$client->login();  // You can optionally pass username/email and password here, otherwise the values from the config file will be used.

// Fetch all fields for all projects with a status of CUR or PLN, that are less than 100% complete.
$results = $client->search(
  'project',                          // workfront object code
  array(                              // query
    'status' => array('CUR', 'PLN'),
    'status_Mod' => 'in',
    'percentComplete' => 100,
    'percentComplete_Mod' => 'lt'
  ),
  '*'                                 // fields (can also be an array of specific fields)
);

$client->logout();

您可以在此处找到其他操作和API信息。

许可证

Laravel Workfront受MIT许可证(MIT)许可。

致谢

这基于Workfront提供的示例代码,作为其API文档的一部分。