承接 bernskioldmedia/laravel-harvest 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bernskioldmedia/laravel-harvest

最新稳定版本:1.1.0

Composer 安装命令:

composer require bernskioldmedia/laravel-harvest

包简介

This is an API wrapper class for the Harvest Time Tracking API.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package adds a fluent way of interacting with the Harvest time tracking system and its API.

Installation

You can install the package via composer:

composer require bernskioldmedia/laravel-harvest

You can publish the config file with:

php artisan vendor:publish --tag="harvest-config"

This is the contents of the published config file:

return [

    /**
     * The API key used for authenticating with the Harvest API.
     */
    'api_key' => env('HARVEST_API_KEY', ''),

    /**
     * The Account ID number from Harvest that you want to use.
     */
    'account_id' => env('HARVEST_ACCOUNT_ID', ''),

    /**
     * The user agent (application name) is sent through to
     * Harvest so that they can identify who requests come from.
     */
    'application_name' => env('HARVEST_APP_NAME', env('APP_NAME')),

    /**
     * The contact e-mail address for the application is required
     * so that Harvest can get in touch for any reason.
     */
    'application_email' => env('HARVEST_APP_EMAIL', ''),

    /**
     * The Base URL for the Harvest API including the version.
     * This package currently only supports V2 of the API.
     */
    'base_url' => env('HARVEST_API_URL', 'https://api.harvestapp.com/v2'),

];

Usage

The package provides a convenient facade to interact with all resources. The package will let you consume the API through fluent methods, but will not touch or map the response coming from the API. Please see the Harvest API docs for more information on responses.

The package currently supports all Harvest API resources, as well as their reporting endpoints. Your IDE should discover them on the Harvest Facade when typing.

When getting lists using the all method there are also fluent filtering methods to help you filter. Additionally some resources have "actions" as well. The names of these functions match mostly to the parameters in the Harvest API docs.

use BernskioldMedia\Harvest\Facades\Harvest;

// Get all clients from Harvest.
Harvest::clients()->all();

// Show only active clients from Harvest.
Harvest::clients()->active()->all();

// Get a single client from Harvest.
Harvest::clients()->get(123);

// Create a client from Harvest.
Harvest::clients()->create(['name' => 'My new client']);

// Update a client in Harvest.
Harvest::clients()->update(123, ['name' => 'My new name']);

// Delete a client from Harvest.
Harvest::clients()->delete(123);

// Mark an invoice as sent.
Harvest::invoices()->send(1);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 822
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-04-15