Skip to content

Instantly share code, notes, and snippets.

View DragonBe's full-sized avatar
The next step…

M van Dam DragonBe

The next step…
View GitHub Profile
DragonBe / UserShield.php
Created April 12, 2023 21:13
This class provides encryption and decryption possibilities to store sensitive data or personal information in a secure way.
namespace Dragonbe\Utility;
use Exception;
* This class provides two-way encryption and decryption
* possibilities to store sensitive data or personal
DragonBe / azure-ad-connect.php
Last active May 26, 2024 21:06
A simple PoC to access Azure AD for authentication
use League\OAuth2\Client\Provider\GenericProvider;
use Microsoft\Graph\Graph;
use Microsoft\Graph\Model;
const OAUTH_APP_ID = '';
DragonBe /
Last active August 16, 2021 07:03
The common pattern for user registration, sign in, reset and removal of an account written out

Auth Stnadard Requirements

Problem statement

To tackle the common application pattern for authenticating, registering, resetting credentials, verifying, and unregistering from an application, the common patterns exists but many implementations make it hard to use the best solutions of different frameworks. While almost each application has this requirement, no standard has been defined.

Possible reasons why it's difficult

  • Too many backend solutions for storing and updating credentials (DB, LDAP/AD, API, SSO, SAML, …)
  • Added complexity when authorisation is required
  • Added complexity when MFA is required
DragonBe / azureConnectionStringToPdo.php
Created May 2, 2021 21:24
Convert an Azure Connection String for MySQL into a PDO resource
* Example usage:
* $connString = 'Database=localdb;Data Source=;User Id=dbuser;Password=$3cR37!';
* $pdo = azureConnectionStringToPdo($connString);
DragonBe / WooCommerce Plugin Privacy Checker
Created May 10, 2020 17:46
Here's a step-by-step process to check if a WooCommerce plugin adopts the privacy functionality provided by the platform by extending WC_Abstract_Privacy.

Plugins checker

This is a small report about plugins I've verified with phpdoc for extending WC_Abstract_Privacy privacy class provided by WooCommerce.

Based on information found in WooCommerce Guidelines for GDPR, Making Woo Extensions GDPR compliant and the whole WC_Abstract_Privacy class API.

Plugins not extending the privacy class

DragonBe / Vagrantfile-php7.3
Created October 8, 2019 21:44
Quickly set up a Vagrantbox with Debian 8 and PHP 7.3
Vagrant.configure("2") do |config| = "debian/jessie64"
config.vm.hostname = "jenkins-php7" "private_network", ip: ""
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provision "shell", inline: <<-SCRIPT
apt-get update
apt-get upgrade -y
apt-get install -y \
ca-certificates \
DragonBe / Vagrantfile
Last active December 5, 2021 23:03
Quickly run PHP 7.2, MySQL 5.7 and Nginx 1.14 within Vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
Vagrant.require_version ">= 2.2.0"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vagrant.plugins = ["vagrant-vbguest"]
DragonBe /
Created June 7, 2018 07:47
Creating a GPG signed archive of your GIT source code with SHA 256 checksums in bash
# Getting the current project's directory
pf=$(printf '%q\n' "${PWD##*/}")
# Getting the current configured user's email
gpguser=$(git config
if [ -z $gpguser ]
echo "!!! ERROR: No user for GIT configured !!!"
DragonBe / Vagrantfile-php7.2
Created March 20, 2018 09:29
A quick Vagrant file to get started with PHP 7.2
# -*- mode: ruby -*-
# vi: set ft=ruby :
@script = <<SCRIPT
# Fix for
if ! grep -q "ubuntu-xenial" /etc/hosts; then
echo " ubuntu-xenial" >> /etc/hosts
DragonBe / Vagrantfile
Created January 19, 2018 16:26
A quick-and-simple VM with PHP 7.2
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config| = "debian/jessie64"
config.vm.host_name = "phpvm"
config.vm.box_check_update = false "private_network", ip: ""
config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"