Symfony bundle that integrates the Cybozu HTTP by providing easy-to-use services and configuration.
- PHP >=5.5
- Composer
- Symfony >=3.1
The recommended way to install Cybozu HTTP is with Composer. Composer is a dependency management tool for PHP that allows you to declare the dependencies your project needs and installs them into your project.
$ curl -sS https://getcomposer.org/installer | php
$ mv composer.phar /usr/local/bin/composer
You can add Cybozu HTTP as a dependency using the composer
$ composer require ochi51/cybozu-http-bundle
Alternatively, you can specify Cybozu HTTP as a dependency in your project's existing composer.json file:
{
"require": {
"ochi51/cybozu-http-bundle": "^1.0"
}
}
After installing, you need to register the bundle in your application.
// app/AppKernel.php
class AppKernel extends Kernel
{
// ...
public function registerBundles()
{
$bundles = array(
// ...
new CybozuHttpBundle\CybozuHttpBundle()
);
}
}
There are two ways that configure cybozu.com account information.
- User entity has it.
# app/config.yml
cybozu_http:
cert_dir: /path/to/cert_dir
logfile: /path/to/logfile.log
use CybozuHttpBundle\Entity\UserInterface;
class User implements UserInterface
{
public function getCybozuHttpConfig()
{
return [
"domain" => "cybozu.com",
"subdomain" => "changeMe",
"use_api_token" => false,
"login" => "changeMe",
"password" => "changeMe",
"token" => null,
"use_basic" => false,
"basic_login" => null,
"basic_password" => null,
"use_client_cert" => false,
"cert_file" => "cert.pem",
"cert_password" => null
];
}
public function getDebugMode()
{
return true;
}
}
<?php
// AppBundle\Controller\MyCybozuHttpController
public function getRecordAction($appId, $recordId)
{
$api = $this->get('cybozu_http.kintone_api_client');
$record = $api->record()->get($appId, $recordId);
// do something
}
To run the tests, Run the following command from the project folder.
$ php ./bin/phpunit
- Japanese documentation.
The MIT License (MIT). Please see LICENSE for more information.