Skip to content

Instantly share code, notes, and snippets.

@devosc
Created July 20, 2015 06:35
Show Gist options
  • Save devosc/7a5474a7659df7731d0a to your computer and use it in GitHub Desktop.
Save devosc/7a5474a7659df7731d0a to your computer and use it in GitHub Desktop.
ViewModel Controller
<?php
var_dump($request->getRequestUri());
<?php
/**
*
*/
return [
'name' => 'home',
'route' => '/',
'controller' => 'Home\Model',
];
<?php
namespace Home;
use Mvc5\View\Model\Base;
use Mvc5\View\Model\Plugin;
use Mvc5\View\Model\ViewModel;
use Mvc5\View\ViewPlugin;
class Model
implements Plugin, ViewModel
{
/**
*
*/
use Base;
use ViewPlugin;
/**
*
*/
const TEMPLATE_NAME = 'home';
public function __invoke($request)
{
$this->vars(['request' => $request]);
return $this;
}
}
@assertchris
Copy link

Elegant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment