定制 infamoustrey/smartsheet 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

infamoustrey/smartsheet

最新稳定版本:0.2.1

Composer 安装命令:

composer require infamoustrey/smartsheet

包简介

An API for Smartsheet

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License

This library serves as a convenience wrapper around the REST API that smartsheet exposes. It also uses the Collections library from the Illuminate library in lieu of arrays, so check that out if you are unfamiliar with it.

Table of Contents

Installation

The preferred method of installing this library is with Composer by running the following from your project root:

composer require infamoustrey/smartsheet

Usage

This library provides a fluent api for interacting with Smartsheet.

$smartsheetClient = new \Smartsheet\SmartsheetClient([ 'token' => 'yourapitoken' ]);

$smartsheetClient->getSheet('sheetid');

Sheets

Fetch a list of sheets

$smartsheetClient = new \Smartsheet\SmartsheetClient([ 'token' => 'yourapitoken' ]);

$smartsheetClient->listSheets(); // Collection<Sheet>

Access a sheet, see the Sheet Object for a list of possible properties.

$smartsheetClient = new \Smartsheet\SmartsheetClient([ 'token' => 'yourapitoken' ]);

$sheet = $smartsheetClient->getSheet('4583173393803140');

// Access some fields
$sheet->getId(); // '4583173393803140'
$sheet->getName(); // 'sheet 1'

// Add some rows
$sheet->addRow([
    'ID' => "39424808324",
    'Transaction Desc' => "Toys",
    'Amount' => 754.23,
]);

Workspace

Fetch a workspace and access its properties. See the Workspace Object for a list of possible properties.

$smartsheetClient = new \Smartsheet\SmartsheetClient([ 'token' => 'yourapitoken' ]);

$workspace = $smartsheetClient->getWorkspace('7116448184199044'); // \Smartsheet\Resources\Workspace

$workspace->getId(); // '7116448184199044'
$workspace->getName(); // 'New workspace'

$workspace->listSheets(); // Collection<Sheet>

// Fetch a sheet by name
$workspace->getSheet('sheet name'); // Sheet

// Create a sheet with some columns
$workspace->createSheet('sheet name', [
    [
        "title" => "Primary",
        "type" => "TEXT_NUMBER",
        "primary" => true
    ]
]);

Folder

Fetch a folder and access its properties. See the Folder Object for a list of possible properties.

$smartsheetClient = new \Smartsheet\Client([ 'token' => 'yourapitoken' ]);

$folder = $smartsheetClient->getFolder('7116448184199044'); // Folder

// Access some fields
$folder->getId(); // '7116448184199044'
$folder->getName(); // 'Projects'
$sheet = $folder->getSheet('sheet name');

Issues

Use this repository's issue tracker to resolve issues and ask questions.

Roadmap

Full api coverage! There's a lot missing, if you see something missing then put in a PR! Your help is appreciated!

Contributing

Feel free to submit a PR, just be sure to explain what you are trying to fix/add when submitting it. If you do decide to add functionality, it must be covered by a test. See the contribution guide for more info.

To run the tests simply run, you'll want to add a .env file(see .env.example) with a valid api token value in the SMARTSHEET_API_TOKEN variable. Tests are also run on pull requests.

./vendor/bin/phpunit

统计信息

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

GitHub 信息

  • Stars: 10
  • Watchers: 4
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-20