Skip to content

Instantly share code, notes, and snippets.

View alle's full-sized avatar

Alessandro Frangioni alle

View GitHub Profile
@Ocramius
Ocramius / check-source-baseline-size.sh
Last active February 24, 2023 10:25
Script to check whether `psalm-baseline.xml` improved/worsened over time
#!/usr/bin/env bash
export TARGET_REF=${TARGET_REF:-HEAD}
git show "$TARGET_REF:psalm-baseline.xml" | xmllint --xpath 'count(//file[not(starts-with(@src, "test"))]/*/code)' -
@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>
*/

Learning Plan for Design Patterns and Principles of Good Design

These learning resources primarily focus on programming using Good Design Principles and Design Patterns

  • There is an emphasis on learning using PHP, although most patterns are universal to every object orientated language.
<?php
declare(strict_types=1);
namespace Funct\Ion\Microsite\Base\ReadModel\MicrositeCollections;
use Prooph\EventStore\Projection\AbstractReadModel;
use RuntimeException;
final class CombinedReadModel extends AbstractReadModel
@mirkorap
mirkorap / symfony4-fos-oauth-server-bundle.md
Last active February 22, 2024 14:51
Basic examples how to implement a REST API with Symfony 4 + FOSRestBundle + FOSUserBundle + FOSOauthServerBundle with all oauth2 code flow
@mathiasverraes
mathiasverraes / rollyourown.php
Created May 30, 2018 14:17
We don't need no DIC libs / we don't need no deps control
<?php
// Context: I'm trying to argue that DI (and DIC) are great, and DIC libs suck.
// Happy to be proven wrong!
final class Router {
private $dependencies;
public function __construct (Dependencies $dependencies) {
$this->dependencies = $dependencies;
// You might say that this is Service Locator, but it's not. This router is toplevel,
// and toplevel must have access to dependencies. After that it can all just bubble nicely using proper DI.
@Nyholm
Nyholm / gist:317df136ded2087649d0c9c464285cb1
Last active August 15, 2023 21:16
Show who contributed to your vendors folder
# Install git fame
gem install git_fame
# Install all vendors with source
rm -rf vendor/*
composer update --prefer-source
# Do the calculations. This might take 30 minutes to complete.
rm output.txt
find ./vendor -type d -depth 2 ! -path "./vendor/composer" -exec echo {} \; -exec git fame --sort=loc --hide-progressbar --repository={} \; >> output.txt
@oqq
oqq / CommandMiddleware.php
Created November 13, 2017 09:35
simple command middleware implementation using prooph components
<?php
declare(strict_types = 1);
namespace Acme\Middleware;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Interop\Http\ServerMiddleware\MiddlewareInterface;
use Prooph\Common\Messaging\MessageFactory;
use Prooph\Psr7Middleware\MetadataGatherer;
@hikari-no-yume
hikari-no-yume / example.php
Created March 20, 2017 20:02
function chaining for PHP 7
<?php declare(strict_types=1);
require_once "✨.🐘";
✨($_)->strlen("foo")->var_dump($_);