Skip to content

Instantly share code, notes, and snippets.

View juriansluiman's full-sized avatar

Jurian Sluiman juriansluiman

View GitHub Profile
@juriansluiman
juriansluiman / Module.php
Created January 30, 2014 09:15
Example how to integrate an EmailService into the ArticleService
<?php
namespace MyEmailThingy;
class Module
{
public function onBootstrap($e)
{
$app = $e->getApplication();
$em = $app->getEventManager();
<?php
namespace MyModule\Service;
use ZfcRbac\Service\AuthorizationService as BaseAuthorizationService;
class AuthorizationService extends BaseAuthorizationService
{
protected $myDependency;
@juriansluiman
juriansluiman / Module.php
Last active August 29, 2015 13:56
Return response on route
<?php
use Zend\Mvc\MvcEvent;
class Module
{
public function onBootstrap($e)
{
$app = $e->getApplication();
$sl = $app->getServiceManager();
$em = $app->getEventManager();
<?php
class MyFactory implements FactoryInterface
{
public function createService()
{
$adapter = // get adapter based on config;
$service = new Service($adapter);
return $service;
}
<?php
namespace Foo;
use Zend\Http\Client as HttpClient;
use Zend\Http\Response as HttpResponse;
use Zend\Http\Exception\ExceptionInterface as HttpException;
use Zend\Json\Json;
@juriansluiman
juriansluiman / keybase.md
Created December 26, 2014 08:18
Keybase.io identity verification

Keybase proof

I hereby claim:

  • I am juriansluiman on github.
  • I am jurian (https://keybase.io/jurian) on keybase.
  • I have a public key whose fingerprint is F425 765A F301 EE83 71B1 35BE 043B E044 6A20 6379

To claim this, I am signing this object:

@juriansluiman
juriansluiman / comments.tag
Last active August 29, 2015 14:14
Test riot-js file for a bug report
<comment-box>
<h1>{ opts.title }</h1>
<comment-list url={ opts.url } comments={ comments } />
<comment-form url={ opts.url } comments={ comments } />
// Start with some in-memory list of comments
this.comments = [{'name': 'Tom', 'message': 'Hi there'}, {'name': 'Paul', 'message': 'Great job'}]
</comment-box>
@juriansluiman
juriansluiman / IndexController.php
Created October 14, 2011 08:31
IndexController with "preDispatch" event simulation
<?php
namespace Application\Controller;
use Zend\Mvc\Controller\ActionController
Zend\Mvc\MvcEvent;
class IndexController extends ActionController
{
public function indexAction()
@juriansluiman
juriansluiman / 1. Application.md
Created November 8, 2011 14:35
Modular application system for ZF2

Application system

This document describes how a system can be formed to set up modules in combination with a tree of pages stored in the database. The general idea is to have pages stored within a database in a tree structure, where every page is coupled to a module (1:n). Pages are queried and parsed to routes as a combination of the page route and the modules route(s).

Goal

Webapplications exist often with a frontend (for normal visitors) and backend (to manage the whole bunch). Also some pages might want to utilize the same module (two simple text pages as basic example). Thirdly, it should be easy for end users to create new pages, modify them or delete pages. To accomplish this, a robust system ("content management framework") should be made on top of zf2 to accomodate this.

Configuration

@juriansluiman
juriansluiman / 1. Wrapper.phtml
Created November 25, 2011 15:11
Three step based view
<?php echo $this->doctype() ?>
<html>
<head>
<?php echo $this->headTitle() ?>
<?php echo $this->headMeta() ?>
<?php echo $this->headLink() ?>
<?php echo $this->headScript() ?>
</head>