PHP code example of clearcode / command-bus-console

1. Go to this page and download the library: Download clearcode/command-bus-console 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/ */

    

clearcode / command-bus-console example snippets


    
    // app/AppKernel.php

    public function registerBundles()
    {
        $bundles = array(
            // ...
            new SimpleBusCommandBusBundle(), // this one you probably have already registered
            new SymfonyConsoleFormBundle(),
            new Clearcode\CommandBusConsole\Bundle\CommandBusConsoleBundle(),
        );
    }

class SignUpType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('id', TextType::class, [
                'label' => 'Id',
            ])
            ->add('name', TextType::class, [
                'label' => 'Name',
            ])
            ->add('email', TextType::class, [
                'label' => 'email',
            ])
        ;
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults([
            'data_class' => SignUp::class,
        ]);
    }

    ...
}