Created
June 25, 2012 15:46
-
-
Save Hounddog/2989368 to your computer and use it in GitHub Desktop.
Restfull Application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
path: module/Application/config | |
<?php | |
return array( | |
'router' => array( | |
'routes' => array( | |
'default' => array( | |
'type' => 'Zend\Mvc\Router\Http\Segment', | |
'options' => array( | |
'route' => '/[:controller[/:action]]', | |
'constraints' => array( | |
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*', | |
'action' => '[a-zA-Z][a-zA-Z0-9_-]*', | |
), | |
'defaults' => array( | |
'controller' => 'index', | |
'action' => 'index', | |
), | |
), | |
), | |
'home' => array( | |
'type' => 'Zend\Mvc\Router\Http\Literal', | |
'options' => array( | |
'route' => '/', | |
'defaults' => array( | |
'controller' => 'index', | |
'action' => 'index', | |
), | |
), | |
), | |
), | |
), | |
'controller' => array( | |
'classes' => array( | |
'index' => 'Application\Controller\IndexController' | |
), | |
), | |
'view_manager' => array( | |
'display_not_found_reason' => true, | |
'display_exceptions' => true, | |
'doctype' => 'HTML5', | |
'not_found_template' => 'error/404', | |
'exception_template' => 'error/index', | |
'template_map' => array( | |
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml', | |
'application/index/index' => __DIR__ . '/../view/application/index/index.phtml', | |
'error/404' => __DIR__ . '/../view/error/404.phtml', | |
'error/index' => __DIR__ . '/../view/error/index.phtml', | |
), | |
'template_path_stack' => array( | |
__DIR__ . '/../view', | |
), | |
'strategies' => array( | |
'ViewJsonStrategy', | |
), | |
), | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
path: module/Site/src/Site/Controller/ | |
<?php | |
namespace Site\Controller; | |
use Zend\Mvc\Controller\RestfulController, | |
Zend\View\Model\JsonModel; | |
class IndexController extends RestfulController | |
{ | |
public function getList () | |
{ | |
return array("index" => array()); | |
} | |
public function get ($id) | |
{ | |
return array("id" => $id); | |
} | |
public function create ($data) | |
{ | |
return array("created" => "yes"); | |
} | |
public function update($id, $data) { | |
return array("updated" => "yes"); | |
} | |
public function delete($id) { | |
return array("deleted" => $id); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
path: module/Site/config/ | |
<?php | |
return array( | |
'controller' => array( | |
'classes' => array( | |
'index' => 'Site\Controller\IndexController', | |
), | |
), | |
'view_manager' => array( | |
'template_path_stack' => array( | |
'site' => __DIR__ . '/../view', | |
) | |
), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment