IKS Blog – The Semantic CMS Community

VIE/CreateJS for your PHP application

We’re in the process of building a PHP library for managing data based on VIE/CreateJS to facilitate the integration of the CreateJS interface and the necessary RDF rendering into the plethora of PHP-based frameworks and applications. While development is done based on the CMS we use in-house (MidCOM), the aim is to make it as generic and as simple to integrate into other systems as possible.

You can read our original proposal here

The gist of it is that we want to automate the (tedious, error-prone) process of rendering the annotations CreateJS needs to function, while giving developers full control over RDF – ORM mappings. The self-same mappings should also be available in the REST implementation so that the data VIE sends can be persisted on the server. Right now, we’re in the design phase, so we’re experimenting with different ways to make an API that is both concise and flexible enough for most use cases.

To give you a rough idea of where we’re going with this, here’s some early API ideas:

 

/* SETUP */

// The config defines property configuration and mappings. Missing settings
// can be autodetected later on by the RdfMapper implementation
$config = get_config_array_from_somewhere();

// This class has to implement the RdfMapper interface for the ORM you use
$rdfMapper = new Doctrine2RdfConverter($config);

// $blogEntry is an ORM object from your framework of choice
$entryController = new CreateJsController($blogEntry, $rdfMapper);
/* OUTPUT */

// Renders the blog entry's title, wrapped in a h1 tag, with all
// relevant annotations
$entryController->title->render('h1');

// Add or replace an attribute value, both regular HTML and RDFa-specific
$entryController->content->setAttribute('class', 'ui-corner-all');

// Customize rendered HTML, with placeholders
$entryController->content->setTemplate('<div class=“content-outer“>
    <div __ATTRIBUTES__>__CONTENT__</div></div>');
/* BACKEND */

// see above for $rdfMapper instantiation
$backend = new CreateJsRestService($rdfMapper);

// This will send the appropriate response or error
$backend->processRequest();

But again, this is far from being set in stone, updates will be posted as they become available. What will happen over the next few weeks is that we implement and test those ideas on two CreateJS-based web sites we currently have in development. This should provide use with some real-life use cases that will help us to determine the actual usefulness and completeness of the new library, and a sample implementation on which other integrations might be based, so stay tuned to see how it goes!

3 Comments

  1. great news! we discussed the topic for the Symfony2 VieBundle but never got to work on it: https://github.com/liip/LiipVieBundle/issues/4

    It would be awesome if you manage to build this library with as few dependencies as possible. Then we could write a bundle that integrates the library into Symfony2 instead of reinventing the wheel.

    Is there a github repository i could watch to follow development?

  2. Hi!

    Yes, the idea is to have the library completely standalone if possible, to make it easy to integrate. What we have right now is stil php5.2 compatible, but we plan to move to namespaces, PSR-0 autoloading and Composer before publication.

    ATM, we’re developing in our inhouse SVN repo, but the code will be moved to github as soon as we settle on a name at least :-) I’ll post another blog entry when that happens!

  3. Pingback: CreatePHP Taking Shape – Another IKS Early Adopter | IKS Blog – The Semantic CMS Community