Skip to content

Instantly share code, notes, and snippets.

<?php
declare(strict_types=1);
use League\Uri\UriTemplate;
use League\Uri\Components\Query;
require 'vendor/autoload.php';
$template = 'https://api.twitter.com/{version}/{?q*}';
@Mattin
Mattin / ProjectionCommand.php
Created June 7, 2021 19:11
Prooph Projection with GapDetection
<?php
declare(strict_types=1);
/**
* TRIFFT BACKEND
* @copyright Copyright (c) 2019 TRIFFT ME s.r.o. (https://www.trifft.me)
* @author Matus Nickel <matus@trifft.me>
*/
@Ocramius
Ocramius / Day.php
Created April 3, 2020 14:13
Example abstraction that only allows a resolution of "day" for time inside a specific business domain
<?php
declare(strict_types=1);
namespace Core\Domain\Time;
use DateTimeImmutable;
use DateTimeZone;
use Generator;
use Iterator;
@basz
basz / README.md
Last active December 18, 2020 08:23

Issue

Projectors fail with contraint errors when rebuilding read models.

Setup description

Implementations of Prooph\EventStore\Projection\AbstractReadModel are used to build read-models. We are using Doctrine Entities for these models. ReadModelProjector::OPTION_PERSIST_BLOCK_SIZE is set to 1000 The persist method of Prooph\EventStore\Projection\AbstractReadModel has been adapted to wrap the stack of changes inside a transaction. (see ReadModelTrait.php)

<?php
declare(strict_types=1);
namespace Funct\Ion\Microsite\Base\ReadModel\MicrositeCollections;
use Prooph\EventStore\Projection\AbstractReadModel;
use RuntimeException;
final class CombinedReadModel extends AbstractReadModel
<?php
final class BigIdSingleStreamStrategy implements PersistenceStrategy, HasQueryHint
{
/**
* @param string $tableName
* @return string[]
*/
public function createSchema(string $tableName): array
{
@kai101
kai101 / wkhtmltopdf.md
Last active August 24, 2023 09:10
How to Install Wkhtmltopdf 12.4 with patched Qt?

How to Install Wkhtmltopdf 12.4 with patched Qt?

For earlier version whos suffering from versionlock syndrome. Please follow the instructions to rollback to older SSL interface. Do not alarm by the fallback ssl interface, they received security patches for vulnerability discovered.

Current version of apt-get wkhtmltopdf does not come with Qt patch. There are some issue going with both Qt patched and non-patched. Most common use case is compatible with the patched Qt.

# Event Stream
CREATE TABLE `event_streams` (
`no` BIGINT(20) NOT NULL AUTO_INCREMENT,
`real_stream_name` VARCHAR(150) NOT NULL,
`stream_name` CHAR(41) NOT NULL,
`metadata` TEXT NOT NULL,
`category` VARCHAR(150),
CHECK (`metadata` IS NOT NULL OR JSON_VALID(`metadata`)),
PRIMARY KEY (`no`),
UNIQUE KEY `ix_rsn` (`real_stream_name`),
@codeliner
codeliner / MongoConnection.php
Last active May 9, 2022 14:55
prooph MongoEventStore v7
<?php
declare(strict_types = 1);
namespace Acme\Infrastructure\MongoDb;
use MongoDB\Client;
use MongoDB\Collection;
class MongoConnection
@chalasr
chalasr / splat_operator.php
Last active April 11, 2016 13:26
function with dynamic number of type-hinted arguments using the splat operator PHP 5.6
<?php
function splat(array ...$args) {
foreach ($args as $arg) {
print_r($arg);
}
}
splat(['firstArray'], ['secondArray']);
// Output: Array( [0] => firstArray ) Array( [0] => secondArray )