Download the PHP package jhq0113/roach-rest-app without Composer

On this page you can find all versions of the php package jhq0113/roach-rest-app. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package roach-rest-app

roach-rest示例应用

使用方式

目录

目录结构介绍

回到目录

部署

nginx部署server示例

回到目录

rest接口示例应用

rest接口示例代码文件为rest/modules/v1/controllers/ProductController.php

在项目根目录有个product-test.php文件,里面编写了默认rest接口的测试调用,如果您使用的是phpstormIDE的话,可以直接使用

回到目录

添加模块

添加自定义模块分为以下几步

回到目录

路由

项目默认路由规则如下

REQUEST_URI 解析规则
/word1 word1解析为controller
/word1/word2 word1解析为controller,word2解析为action
/word1/word2/word3 word1解析为module,word2解析为controller,word3解析为action
/word1/word2/word3/word4?word5=word6 word1解析为module,word2解析为controller,word3解析为action,word4不会解析,word5为参数key,word6为参数值

自定义路由

项目路由类为roach\rest\Router,如果系统路由不能满足您的需要,我们可以自己实现一个路由,步骤如下

回到目录

Controller

REQUEST_METHOD控制

每个action的REQUEST_METHOD的控制是靠ControlleractionMethodMap属性控制的,如下

控制器生命周期

控制器有beforeafter两个钩子方法,以下是控制器执行流程

注意:

回到目录

应用生命周期

image

注意

回到目录

console应用

console应用是一个控制台应用,位于console目录

console应用默认不使用模块,也可以参考rest应用添加模块应用

console应用路由规则与rest应用路由规则一致

console应用如果由cron定时任务执行,注意标注输出和错误输出异常,默认不进行输出

可以通过roach\extensions\ECli::params()来获取参数

回到目录

多环境管理

环境选择

roach-rest的环境选择配置在php.ini中,如下

代码中我们可以通过调用roach\extensions\EEnvir::envir方法获取环境配置值

配置选择

回到目录

使用orm

roach-rest并未提供orm支持,开发者可以自行选择基于composerorm组件,例如roach-orm

https://github.com/jhq0113/roach-orm

回到目录

异常错误处理

roach-rest对异常和错误做了统一处理,当项目运行时触发了未被try...catch捕捉的异常时,会统一交由errorHandler组件处理,配置如下

roach-rest提供了一个handler,封装在common\ErrorHandler::handler,开发者可以根据自己需要进行扩展

回到目录


All versions of roach-rest-app with dependencies

PHP Build Version
Package Version
Requires jhq0113/roach-rest Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jhq0113/roach-rest-app contains the following files

Loading the files please wait ....