PHP code example of stolfam / content-manager-php

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

    

stolfam / content-manager-php example snippets


final class YourModifier implements IModifier {
    public function modify(Content $content): Content {
        // replace each word 'sample' for 'test'
        $content->body = str_replace('sample', 'test', $content->body);

        return $content
    }
}

// instance of IContentRepository
$contentContainer = $contentRepository->listContent( new ContentFilter([
        ContentFilter::TAGS => ['tag1', 'tag2]
    ]) );

// optional: adding an IModifier
$contentContainer->addModifier( new YourModifier() );

// rendering a content named 'sample'
echo $contentContainer->sample;