Skip to content

Instantly share code, notes, and snippets.

The next step…

Michelangelo van Dam DragonBe

The next step…
View GitHub Profile
DragonBe / phonenumberfilter
Created Mar 15, 2012
Simple filtering of phone numbers
View phonenumberfilter
$phoneNumber = '(202) 555-2041';
$filterPhone = preg_repace('/[^0-9]+/','', $phoneNumber);
DragonBe / phpunit.xml
Created Oct 8, 2012
Setting up a clean phpunit configuration for Zend Framework 2
View phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="bootstrap.php" colors="true">
<testsuite name="zf2demo">
DragonBe / install.stout
Created Oct 8, 2012
Output of composer installation of ZF2
View install.stout
phpbook:zf2demo dragonbe$ php composer.phar install --dev
Loading composer repositories with package information
Installing dependencies
- Installing zendframework/zendframework (2.0.2)
Downloading: 100%
Loading composer repositories with package information
Installing dev dependencies
Nothing to install or update
zendframework/zendframework suggests installing doctrine/common (Doctrine\Common >=2.1 for annotation features)
DragonBe / listCDNEndpoints.php
Created Nov 6, 2012
My trial to access CDN API of Windows Azure
View listCDNEndpoints.php
public function listCdnEndpoints()
$context = new HttpCallContext();
// echo '<pre>' . var_export($context,1) . '</pre>';die;
$response = $this->sendContext($context);
DragonBe / GoogleTracker.php
Created Mar 28, 2013
Example view helper for rendering the google analytics script
View GoogleTracker.php
class In2it_View_Helper_GoogleTracker extends Zend_View_Helper_Abstract
public $view;
public function setView(Zend_View_Interface $view)
return parent::setView($view);
DragonBe / NikTest.php
Created Nov 22, 2013
Accessing protected and private properties
View NikTest.php
class Nik
public $name;
protected $_function;
private $_age;
private function _getProperties()
DragonBe / get_object_vars.php
Last active Dec 29, 2015
Change in the way get_object_vars behaves in PHP 5.4 and PHP 5.5
View get_object_vars.php
abstract class AbstractModel {
public function toArray($includeProtected = false)
if ($includeProtected == true) {
return get_object_vars($this);
// Wrapping this object in a closure changes the lexical scope, which
// allows us to easily return only public properties.
DragonBe /
Last active Aug 29, 2015
Procedure to autoload ZF1 applications in Apigility

Autoloading ZF1 apps in Apigility

This is a procedure I write to autoload a ZF1 project into a ZF2 based application, using Apigility as an example.


  • PHP 5.4 or higher
  • A ZF1 project, I'm using my demo application zfdemo as example
  • Composer
  • An IDE
DragonBe / Product.php
Created Mar 28, 2014
Example usage for ArrayAccess interface
View Product.php
class Product implements ArrayAccess
protected $_productId;
protected $_title;
protected $_price;
protected $_arrayAccess;
public function __construct($data = null)

Keybase proof

I hereby claim:

  • I am dragonbe on github.
  • I am dragonbe ( on keybase.
  • I have a public key whose fingerprint is 2FAD DAA1 D05E 185E 54BF 49A1 85BF 2A2B CDE4 64C3

To claim this, I am signing this object:

You can’t perform that action at this time.