PHP code example of gpupo / content-butler

1. Go to this page and download the library: Download gpupo/content-butler 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/ */

    

gpupo / content-butler example snippets


//...
use Gpupo\ContentButler\Helpers\DocumentHelper;
$documentHelper = new DocumentHelper($this->documentManager, $spliter = 'Resources', $versionable = true);
$document = $documentHelper->factoryDocument('var/file/path.jpg', 8068, true);

if ($this->documentManager->find(null, $document->getEndpoint())) {
    throw new \Exception(sprintf('Node %s already exists', $document->getEndpoint()));
}

$output->writeln(sprintf('Saving node <info>%s</>', $document->getEndpoint()));
$this->documentManager->persist($document);
$this->documentManager->flush();