1. Go to this page and download the library: Download berlinonline/dat0r 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/ */
berlinonline / dat0r example snippets
// once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
// then register our generated package to Dat0r.
Dat0r\Autoloader::register(array(
'Example\DataObject' => __DIR__ . DIRECTORY_SEPARATOR . 'data_objects'
));
xample\DataObject\Article;
$module = Article\ArticleModule::getInstance();
$article = $module->createDocument(array(
'title' => "This is an article's title.",
'teaser' => "This is an article's teaser text.",
'paragraph' => "This is an article's paragraph",
'slug' => "article-example-slug"
));
$article->setTitle("This an article's changed title.");
$article->setTeaser("This an article's changed teaser text.");
foreach ($article->getChanges() as $idx => $changeEvent)
{
printf("- event number %d:\n%s\n", $idx + 1, $changeEvent);
}
printf("- current data:\n%s", print_r($article->toArray(), TRUE));