Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Enjoying my new job :)

burzum

💭
Enjoying my new job :)
View GitHub Profile
@burzum
burzum / install-phps.sh
Last active Jan 6, 2021
Install php versions and modules automatically on Ubuntu
View install-phps.sh
#!/usr/bin/env bash
# https://computingforgeeks.com/how-to-install-php-on-ubuntu/
phpVersions=('7.2' '7.3' '7.4')
modules=('cli' 'fpm' 'bcmath' 'gd' 'xml' 'mbstring' 'xml' 'curl' 'pgsql' 'imagick' 'intl' 'amqp' 'intl' 'imap' 'opcache')
sudo apt-get update
sudo apt -y install software-properties-common
sudo add-apt-repository -y ppa:ondrej/php
View Query.php
public function applyOptions(array $options)
{
$valid = [
'fields' => 'select',
'conditions' => 'where',
'join' => 'join',
'order' => 'order',
'limit' => 'limit',
'offset' => 'offset',
'group' => 'group',
View eventstore-v8.php
<?php
use GuzzleHttp\Client as GuzzleClient;
use Http\Adapter\Guzzle6\Client;
use Prooph\EventStore\ExpectedVersion;
use Prooph\EventStore\EventData;
use Prooph\EventStore\UserCredentials;
use Prooph\EventStoreHttpClient\ConnectionSettings;
use Prooph\EventStoreHttpClient\EventStoreConnectionFactory;
$userCredentials = new UserCredentials('admin', 'changeit');
View read_and_watch_todo.md
View test.php
<?php
namespace Authentication\Test\TestCase\Identifier\Resolver;
use Authentication\Identifier\Resolver\EloquentResolver;
use Authentication\Test\TestCase\AuthenticationTestCase;
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Database\Connection;
use Illuminate\Database\ConnectionResolverInterface;
use Illuminate\Database\Eloquent\Model;
@burzum
burzum / ElasticPaginator.php
Created Aug 21, 2017
CakePHP ES Paginator
View ElasticPaginator.php
<?php
declare(strict_types=1);
namespace App\Datasource;
use Cake\Datasource\Paginator;
use Cake\Datasource\RepositoryInterface;
use Cake\ElasticSearch\Query;
use Cake\Network\Exception\NotFoundException;
@burzum
burzum / phpcs.xml
Last active Jul 17, 2017
Custom phpcs config for PSR2 without the god damn aweful spaces - enforce tabs!
View phpcs.xml
<?xml version="1.0"?>
<ruleset name="PSR2-Fuck-Spaces">
<rule ref=".\vendor\cakephp\cakephp-codesniffer\CakePHP\ruleset.xml"/>
<file>./src</file>
<file>./tests</file>
<rule ref="PSR2">
<exclude name="PSR2.Classes.ClassDeclaration"></exclude>
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
</rule>
@burzum
burzum / src\Pdf\Engine\TexToPdfEngine.php
Last active Dec 10, 2015
src/Pdf/Engine/TexToPdfEngine.php
View src\Pdf\Engine\TexToPdfEngine.php
<?php
namespace App\Pdf\Engine;
use CakePdf\Pdf\CakePdf;
use CakePdf\Pdf\Engine\AbstractPdfEngine;
use Cake\Core\Exception\Exception;
use Cake\Utility\Text;
/**
* TexToPdfEngine for the CakePdf Plugin
View Table\TablePrefixTrait.php
<?php
namespace App\Model\Table;
use Cake\Core\Configure;
/**
* Database Prefix Trait for CakePHP 3.0
*
* @author Florian Krämer
* @license MIT
@burzum
burzum / DbPrefixTrait.php
Created Aug 7, 2015
CakePHP 3.0 DB Connection Prefix
View DbPrefixTrait.php
<?php
namespace App\Model\Table;
use Cake\Core\Configure;
/**
* Database Prefix Trait for CakePHP 3.0
*
* @author Florian Krämer
* @license MIT