2017 © Pedro Peláez
 

library cloudcms-sdk

PHP sdk for the CloudCms Api

image

idealley/cloudcms-sdk

PHP sdk for the CloudCms Api

  • Tuesday, March 7, 2017
  • by Idealley
  • Repository
  • 2 Watchers
  • 2 Stars
  • 58 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Cloud CMS SDK for PHP

Cloud CMS is a "headless" CMS., (*1)

This is a framework agnostic PHP SDK.

Here is the Laravel5 wrapper, (*2)

What can it do

For now the SDK allows to read content from CloudCms as well as to write/update a node. We will be adding more features, but for now the SDK allows to create a full fonctional website using Cloud CMS as content management., (*3)

How to install

composer require idealley/cloudcms-sdk, (*4)

Main available methods

You can get a children of a node like this (think category or list of blogs), (*5)

    $catnode = 'o:9a8195e6286a4f7b40ae';

    $nodes = CC::nodes()
            ->listChildren($catnode)
            ->addParams(['full' => 'true'])
            ->get(); 

Or a single node (for now we are getting it from a special slug field) like this:, (*6)

    $node = CC::nodes()
                ->find($slug)
                ->addParams(['full' => 'true'])   
                ->get();

You can chain paramas, (*7)

    $node = CC::nodes()
                ->find($slug)
                ->addParams(['full' => 'true']) 
                ->addParams(['metadata' => 'true'])   
                ->get();           

or pass them in a single array, (*8)

                ->addParams(['full' => 'true', 'metadata' => 'true']) 

You can get an image like this, (*9)

    $path = 'Samples/Catalog/Products/';            
    $img = CC::nodes()
                ->getImage($node['rows'][0]['_qname'])
                ->addParams(['name' => $node['rows'][0]['_features']['f:filename']['filename']])
                ->addParams(['size' => '400'])
                ->set();

You can chain any params as per the documentation, (*10)

Refer to repository/Node.php to see all available methods. They are documented with working examples, (*11)

Model (Schema)

In order to simplyfy the display of the content you can save the model (schema) from Cloud CMS locally. Then when you have a sucessfull request you can compare it to the model. All properties are available and you do not need to check if they are set., (*12)

This method will get the model and save it locally, (*13)

    CC::setModel('your:content-type');

This method will delet the model (when you update it in Cloud CMS), (*14)

    CC::setModel('your:content-type');

Here is an example of parsing, (*15)

        foreach ($items as $key => $i){
            // You can do it as the commented lign if you do use Cloud CMS array elements (repeatable elements in the interface)
            //$item += $this->model;
            //If not do it like this
            $item = array_replace_recursive($this->model, $i);
            [...]
            // you can then work on your fields for example to parse markdown
            // the $item has ben objectified before hand
            $item->body = Markdown::parse($item->body);
            //but you could do it like this if your prefer to work on an array
            $item['body'] = Markdown::parse($item['body']);

Todo

  • Use a proxy url to fetch the images/documents
  • add more methods

Get documents and images stored in Cloud CMS

  • Get images you with the node.js server developped by Cloud CMS to fetch and cache the images you need.
  • Deploy an application and use the deployement url

The Versions

07/03 2017

dev-master

9999999-dev

PHP sdk for the CloudCms Api

  Sources   Download

MIT

The Requires

 

by Samuel Pouyt

07/03 2017

v1.0.5

1.0.5.0

PHP sdk for the CloudCms Api

  Sources   Download

MIT

The Requires

 

by Samuel Pouyt

07/03 2017

v1.0.3

1.0.3.0

PHP sdk for the CloudCms Api

  Sources   Download

MIT

The Requires

 

by Samuel Pouyt

11/10 2016

v1.0.2

1.0.2.0

PHP sdk for the CloudCms Api

  Sources   Download

MIT

The Requires

 

by Samuel Pouyt

05/10 2016

v1.0.1

1.0.1.0

PHP sdk for the CloudCms Api

  Sources   Download

MIT

The Requires

 

by Samuel Pouyt

18/08 2016

v1.0.0

1.0.0.0

PHP sdk for the CloudCms Api

  Sources   Download

MIT

The Requires

 

by Samuel Pouyt