Skip to content

Instantly share code, notes, and snippets.

View jdreesen's full-sized avatar

Jacob Dreesen jdreesen

View GitHub Profile
@lyrixx
lyrixx / ContainerTest.php
Last active February 24, 2026 11:06
Test applications services can boot
<?php
namespace Tests\Integration;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Bundle\FrameworkBundle\Test\TestContainer;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
class ContainerTest extends KernelTestCase
@lyrixx
lyrixx / test.php
Last active July 18, 2024 09:51
Symfony Playgound with its Container and a custom configuration
<?php
use App\Kernel;
require __DIR__.'/vendor/autoload_runtime.php';
use Symfony\Component\Console\Output\StreamOutput;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@cspray
cspray / class-string-rfc.md
Last active October 9, 2025 20:15
RFC: Introduce a class-string type

RFC: Introduce a class-string type

  • Version: 0.3
  • Last Substantial Updates: 2022-05-04
  • Target Version: PHP 8.next

Introduction

There are many scenarios in which userland code might need to pass parameters to a method or assign a value to a property that is intended to represent a class. Currently the only way to type-hint that a provided value represents a fully-qualified class-name (FQCN) is through userland code. This RFC proposes adding a new internal type that would verify provided values are FQCN.

@yariksheptykin
yariksheptykin / pimcore-demo.sh
Last active December 9, 2021 14:40
Spin up pimcore demo
#!/usr/bin/env bash
set -eu
# A bash script to spin up pimcore demo locally using docker.
# The script follows the README instructions for docker.
# See: https://github.com/pimcore/demo
# Usage:
# curl -s https://gist.githubusercontent.com/yariksheptykin/9eaa93910c5ef9360697a507cd01488a/raw/pimcore-demo.sh | bash -s [up|down] <project-name>
@Ocramius
Ocramius / psalm-compendium.php
Last active April 23, 2025 01:22
A small compendium of what is possible with `vimeo/psalm` 3.9.x to add some decent type system features to PHP
<?php
// -- types are a compile-time propagated concept
// https://psalm.dev/r/338f74a96c
class TheType
{
/** @var string */
public $foo = 'bar';
}
@rezan
rezan / jwt_jwk.vcl
Created March 2, 2020 17:16
Varnish VCL example for JWT and JWK
#
# JWT - Remote JWK API
#
vcl 4.1;
import edgestash;
import goto;
import http;
import json;
@lyrixx
lyrixx / HardCoreDebugLogger.php
Last active October 24, 2025 14:52
Hardcore Debug Logger
<?php
const STREAM_OPEN_FOR_INCLUDE = 128;
final class HardCoreDebugLogger
{
public static function register(string $output = 'php://stdout')
{
register_tick_function(function () use ($output) {
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
@dunglas
dunglas / example.php
Created April 19, 2018 06:25
A minimalist GraphQL client for PHP
<?php
$query = <<<'GRAPHQL'
query GetUser($user: String!) {
user (login: $user) {
name
email
repositoriesContributedTo {
totalCount
}
@DawidMyslak
DawidMyslak / vue.md
Last active May 14, 2026 04:44
Vue.js and Vuex - best practices for managing your state

Vue.js and Vuex - best practices for managing your state

Modifying state object

Example

If you have to extend an existing object with additional property, always prefer Vue.set() over Object.assign() (or spread operator).

Example below explains implications for different implementations.

@jaredpalmer
jaredpalmer / ReducerComponent.js
Last active July 27, 2019 15:59
React.ReducerComponent
import React from 'react';
class ReducerComponent extends React.Component {
constructor(props) {
super(props);
}
reducer = (state, action) => state;
dispatch = action => this.setState(state => this.reducer(state, action));