PHP code example of ochi51 / cybozu-http-bundle

1. Go to this page and download the library: Download ochi51/cybozu-http-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ochi51 / cybozu-http-bundle example snippets

{.php}
    // app/AppKernel.php
    class AppKernel extends Kernel
    {
        // ...
        public function registerBundles()
        {
            $bundles = array(
                // ...
                new CybozuHttpBundle\CybozuHttpBundle()
            );
        }
    }
{.php}
    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
    }