appserver.io是一个多线程的PHP应用服务器,实现真正多线程的PHP编程,高效安全而且快速,速度比基于Nginx的Magento标准安装要快50%。使用上非常像Java的Servlet。
亮点:
使用Doctrine作为标准的持久层
SessionBeans(stateful,stateless+singleton)
MessageBeans
TimerService(tbd)
ServletEngine
IntegratedMessageQueue
Easyscaling
Webservices
要求:
PHP5.4+onx64orx86
ZTSenabled(threadsafety)
POSIXthreadsimplementation
Memcached(2.1+)
示例配置:
<servlet> <description><![CDATA[A demo servlet]]></description> <display-name>DemoServlet</display-name> <servlet-name>DemoServlet</servlet-name> <servlet-class>\TechDivision\Example\Servlets\DemoServlet</servlet-class></servlet><servlet-mapping> <servlet-name>DemoServlet</servlet-name> <url-pattern>/</url-pattern></servlet-mapping>示例代码:
public function doGet(Request $req, Response $res){ // build path to template $pathToTemplate = $this->getServletConfig()->getWebappPath() . DIRECTORY_SEPARATOR . 'static' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'layout.phtml'; // init template $template = new DemoTemplate($pathToTemplate); $baseUrl = '/'; // if the application has NOT been called over a //VHost configuration append application folder naem if (!$this->getServletConfig()->getApplication()->isVhostOf( $req->getServerName()) ) { $baseUrl .= $this->getServletConfig()->getApplication()->getName() . '/'; } // set vars in template $template->setBaseUrl($baseUrl); $template->setRequestUri($req->getUri()); $template->setUserAgent($req->getHeader("User-Agent")); $template->setWebappName($this->getServletConfig()->getApplication()->getName()); // set response content by render template $res->setContent($template->render());}
评论