Coder Social home page Coder Social logo

kintone-php's Introduction

The kintone SDK for PHP

cybozu.com にて提供されている kintone REST API を使いやすくするPHP製のライブラリです。

必要条件

PHP 8.0+

これより古いPHPのバージョンで動作させたい場合、betaブランチをご利用ください。

インストール方法

コンポーザー

"require": {
    "hissy/kintone-php": "dev-master"
}

使い方

require 'vendor/autoload.php';

use Kintone\Request;
use Kintone\Base;
use Kintone\App\App;

// サブドメイン
$subdomain = '012ab';
// APIトークン
$apitoken  = 'BuBNIwbRRaUvr33nWXcfUZ5VhaFsJxN0xH4NPN92';

// 初期設定
$request = new Request($subdomain,$apitoken);

// アプリ情報の取得
$appID = 15;
$app = new App($request);
try {
    // IDを指定してアプリ情報を取得
    $res = $app->getByID($appID);
    echo $res->getName();
} catch (\GuzzleHttp\Exception\ServerException $e) {
    // 5xxエラーレスポンスの取得
    echo $e->getResponse()->getBody();
} catch (\GuzzleHttp\Exception\ClientException $e) {
    // 4xxエラーレスポンスの取得
    echo $e->getResponse()->getBody();
} catch (\GuzzleHttp\Exception\GuzzleException $e) {
    echo get_class($e) . ': ' . $e->getMessage();
}

// 短縮型
$name = (new App($request))->getByID($appID)->getName();
echo $name;

// コマンドとパラメーターを直接指定して情報を取得する方法
$app = new Base($request);
$app->setResource('app');
$res = $app->get(['id' => $appID]);
echo $res->getValue('name'); // 結果は App を使った場合と同じ

詳細はWikiをご覧ください。

ライセンス

MITライセンス

kintone-php's People

Contributors

hissy avatar

Stargazers

maul20 avatar nekosa mishima avatar H.Ikeda avatar Tristan Bailey avatar Ryosuke Kawamura avatar Takashi Ushirosako avatar Rikiya Kawakami avatar gucci avatar Koji Asaga avatar Masao Niizuma avatar

Watchers

 avatar James Cloos avatar Masao Niizuma avatar Takashi Ushirosako avatar

Forkers

ciumabok

kintone-php's Issues

Add Records class

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.