PHP code example of proophsoftware / prooph-bundle

1. Go to this page and download the library: Download proophsoftware/prooph-bundle 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/ */

    

proophsoftware / prooph-bundle example snippets


class Version20160202155238 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        \Prooph\EventStore\Adapter\Doctrine\Schema\EventStoreSchema::createSingleStream($schema, 'event_stream', true);
    }

    public function down(Schema $schema)
    {
        \Prooph\EventStore\Adapter\Doctrine\Schema\EventStoreSchema::dropStream($schema, 'event_stream');
    }
}

class Version20160202160810 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        \Prooph\EventStore\Snapshot\Adapter\Doctrine\Schema\SnapshotStoreSchema::create($schema, 'snapshot');
    }

    public function down(Schema $schema)
    {
        \Prooph\EventStore\Snapshot\Adapter\Doctrine\Schema\SnapshotStoreSchema::drop($schema, 'snapshot');
    }
}

    /* @var $container \Symfony\Component\DependencyInjection\ContainerBuilder */
    
    /* @var $commandBus \Prooph\ServiceBus\CommandBus */
    $commandBus = $container->get('prooph.service_bus.command_bus');

    $command = new \Prooph\ProophessorDo\Model\User\Command\RegisterUser(
        [
            'user_id' => \Rhumsaa\Uuid\Uuid::uuid4()->toString(),
            'name' => 'prooph',
            'email' => '[email protected]',
        ]
    );

    $commandBus->dispatch($command);

    /* @var $container \Symfony\Component\DependencyInjection\ContainerBuilder */
    $userFinder = $container->get('Prooph\ProophessorDo\Projection\User\UserFinder');

    $users = $userFinder->findAll();

// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        //...
        new Prooph\InteropBundle\ProophInteropBundle(),
        new Prooph\Bundle\ProophBundle(),
        new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
    );
}