Marcelo Rodovalho
Marcelo Rodovalho

Reputation: 923

Can I use Zend Router without Zend structure?

I have created a set of classes, and would like to route them using the Zend Router.

My structure follows the following pattern:

/php/
    /REST/
        index.php
    ClassOneService.php
    ClassTwoService.php
    ClassThreeService.php

I would like to have access to methods of classes (ClassOneService.php, ..., ClassNService.php) across a URL, for example:

class ClassOneService extends Connect {
    public function test () {
        echo 'hello';
    }
}

across

http://localhost/php/REST/classe_one/test

My question is: Can I use the system routes the Zend without converting my application format in Zend?

Would not want to use the MVC pattern nor extenders my classes to classes of Zend Controller, just route my methods with the Zend Router.

Upvotes: 0

Views: 101

Answers (1)

Rijndael
Rijndael

Reputation: 3743

Yes you can.

Copy the Library/Zend folder over to your application path and then do:

require_once 'Zend/Controller/Router/Rewrite.php';
require_once 'Zend/Controller/Router/Route.php';

$rewrite = new Zend_Controller_Router_Rewrite();

$rewrite->addRoute(.....));

Upvotes: 1

Related Questions