Skip to content

Instantly share code, notes, and snippets.

View faizalpribadi's full-sized avatar
⏱️
Time Travel

Faizal Pribadi faizalpribadi

⏱️
Time Travel
View GitHub Profile
@faizalpribadi
faizalpribadi / Debug.php
Created July 7, 2013 09:50
Simple Example Mozart Twig Extension ( Templating For Web Application )
$systemLoader = new \Twig_Loader_Filesystem(__DIR__ . '/Resources/templates');
$twig = new \Twig_Environment($systemLoader);
$twig->addExtension(new PanadaExtension());
$template = $twig->loadTemplate('index.html');
echo $template->render($_REQUEST);
@faizalpribadi
faizalpribadi / Container.php
Created June 19, 2013 17:12
Dependency Injection | Inject Other Object Converting To String Alias @see : http://picocontainer.codehaus.org/ - http://picocontainer.com/
<?php
namespace YourApp;
/*
* This file is a part of Mozart PHP Small MVC Framework
*
* (c) Faizal Pribadi <faizal_pribadi@aol.com>
*
* For the full copyright and license information, please view the LICENSE
*
@faizalpribadi
faizalpribadi / ContainerEvent.php
Last active December 17, 2015 21:38
Mozart Event Component Couple With Mozart Dependency Injection Component !
<?php
/**
* Build couple the component of Mozart PHP
* Create the custom event and dispatch With Dependency Injection
* Simple And Very Interesting
*/
/**
@faizalpribadi
faizalpribadi / ContainerBuilderUp.php
Created December 2, 2012 05:46
Symfony Console With Dependency Injection As Service !
<?php
namespace Mozart\Library\DependencyInjection;
class ContainerBuilderUp
{
public function running()
{
$format = '(%1$2d = %1$04b) = (%2$2d = %2$04b)'
. ' %3$s (%4$2d = %4$04b)' . "\n";
@faizalpribadi
faizalpribadi / SemanticalEvent.php
Created November 28, 2012 03:23
Simple Callback Function Event
<?php
interface SemanticalEventInterface
{
public function set($eventName);
public function get($functionName);
}
class SemanticalEvent implements SemanticalEventInterface
{
private $eventName;
@faizalpribadi
faizalpribadi / EventTest.php
Created November 28, 2012 03:06
Example Mozart PHP Event
$fileLoader = dirname(dirname(__FILE__));
require $fileLoader . '/autoload.php';
use Mozart\Library\Event\Event;
use Mozart\Library\Event\EventDispatcher;
class OhMyEventListener
{
public function create(Event $event)
{
@faizalpribadi
faizalpribadi / Access.php
Created November 26, 2012 06:48
Mozart Annotation
<?php
namespace Mozart\Library\Annotations;
/*
* This file is a part of Mozart PHP Small MVC Framework
*
* (C) Faizal Pribadi - Gesture Media Ltd - 2012
*
* For the full copyright and license information, please view the LICENSE
*
@faizalpribadi
faizalpribadi / TestAnnotation.php
Created November 25, 2012 16:46
@mozart\Annotations Example
<?php
namespace App;
/**
* import annotations
*/
use Mozart\Library\Annotations as Mozart;
/**
* @Annotation
@faizalpribadi
faizalpribadi / ShellCommand.php
Created November 8, 2012 04:45
Shell Command Updated
<?php
namespace Mozart\Library\Console;
use Mozart\Library\Console\Console;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Shell;
use Symfony\Component\Console\Command\Command;
/**