PHP code example of pccomponentes / topic-generator

1. Go to this page and download the library: Download pccomponentes/topic-generator 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/ */

    

pccomponentes / topic-generator example snippets


    
    declare(strict_types=1);
    
    class PcComponentes extends \PcComponentes\TopicGenerator\Company
    {
        private const COMPANY_NAME = 'pccomponentes';
    
        public function name(): string
        {
            return self::COMPANY_NAME;
        }
    }
    

    
    declare(strict_types=1);
    
    class Picking extends \PcComponentes\TopicGenerator\Service
    {
        private const SERVICE_NAME = 'picking';
    
        public function name(): string
        {
            return self::SERVICE_NAME;
        }
    }
    


declare(strict_types=1);

$version = '1';
$type = 'command';
$resource = 'parcel';
$name = 'register';

$topic = \PcComponentes\TopicGenerator\Topic::generate(
    PcComponentes::instance(),
    Picking::instance(),
    $version,
    $type,
    $resource,
    $name
);

echo $topic;