onramplab/php-content-generator

There is no license information available for the latest version (v1.2.0) of this package.

A content generator for PHP

v1.2.0 2025-03-14 02:54 UTC

README

ContentGenerator is a PHP package designed to manage and generate content using templates and contexts.

Installation

To install the package, use Composer:

composer require onramplab/php-content-generator

Usage

Here's a basic example of how to use the ContentGenerator:

use ContentGenerator\Application\ContentGenerator;
use ContentGenerator\Application\ContextManager;
use ContentGenerator\Application\TemplateManager;
use ContentGenerator\Domain\Context\DefaultContextDataProvider;

// Initialize managers
$contextManager = new ContextManager();
$templateManager = new TemplateManager();

// Create ContentGenerator instance
$contentGenerator = new ContentGenerator($contextManager, $templateManager);

// Register a context
$contentGenerator->registerContext('name', new DefaultContextDataProvider('name'));

// Register a template
$contentGenerator->registerTemplate('greeting', 'Hello, {{ name }}!');

// Generate content
$content = $contentGenerator->generateContent('greeting');
echo $content; // Outputs: Hello, name!

Testing

To run the tests, use PHPUnit:

php vendor/bin/phpunit

Ensure that Xdebug is properly configured if you encounter any issues related to debugging.