PHP code example of bro-world / core-bundle

1. Go to this page and download the library: Download bro-world/core-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/ */

    

bro-world / core-bundle example snippets


// config/bundles.php
return [
    // ...
    Bro\WorldCoreBundle\BroWorldCoreBundle::class => ['all' => true],
];

// Pseudocode inside the bundle (guarded):
if ($builder->hasExtension('doctrine') && class_exists(\Ramsey\Uuid\Doctrine\UuidBinaryOrderedTimeType::class)) {
    $container->extension('doctrine', [
        'dbal' => [
            'types' => [
                'uuid_binary_ordered_time' => \Ramsey\Uuid\Doctrine\UuidBinaryOrderedTimeType::class,
            ],
        ],
    ]);
}

use Bro\WorldCoreBundle\Infrastructure\Service\ApiProxyService;
use Symfony\Component\HttpFoundation\Request;

final class ExampleUploader
{
    public function __construct(private ApiProxyService $proxy) {}

    public function __invoke(Request $request): array
    {
        return $this->proxy->requestFile('POST', 'media', $request, [
            'contextKey' => 'product-images',
            'mediaFolder' => 'product-images',
        ]);
    }
}

use Bro\WorldCoreBundle\Infrastructure\Service\Clock;

final class ExampleController
{
    public function __construct(private Clock $clock) {}

    public function __invoke(): string
    {
        return $this->clock->now()->format(DATE_ATOM);
    }
}