Download the PHP package shayvmo/webman-annotations without Composer

On this page you can find all versions of the php package shayvmo/webman-annotations. 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 webman-annotations

webman 框架 注解路由插件

使用了 doctrine/annotations 包来对代码内的注解进行解析。

您可以直接在控制器类或类方法定义注解,实现路由定义。

webman框架插件地址:https://www.workerman.net/plugin/115

站在巨人的肩膀可以看到更远,感谢 https://www.workerman.net/plugin/52 的启发。

安装

使用

配置文件

一、中间件注解

注:方法会继承类定义的中间件。

类和方法通用,参数中间件类名,单个中间件传入字符串,多个中间件传入字符串数组。

二、类注解

类注解有控制器注解@RestController和资源路由@ResourceMapping。 资源路由和webman框架原有的资源路由一致。参考:webman路由

控制器注解

@RestController控制器注解,只有一个参数prefix,表示整个控制器的路由路径前缀,方法路由路径都会拼接该前缀。 传参可以省略键名。

php8注解

资源路由注解

@ResourceMapping资源路由注解,有pathallow_methods两个参数 path表示资源路由的路径,allow_methods为指定的资源方法数组,不传指定资源方法时,使用全部资源方法 path传参可以省略键名。

php8注解

注:如果定义了资源路由,会自动忽略类同名方法的方法注解。

附:资源路由方法对照

请求方法 路径 类方法
GET /test index
GET /test/create create
POST /test store
GET /test/{id} show
GET /test/{id}/edit edit
PUT /test/{id} update
DELETE /test/{id} destroy
PUT /test/{id}/recovery recovery

三、方法注解

方法注解主要是@RequestMapping 以及 @GetMapping@PostMapping@PutMapping@DeleteMapping 四个便捷注解。 定义路由路径 path 和请求方法methods。两个参数均可以传入字符串或数组。 例如path传入数组时,表示多个请求路由路径。methods传入数组时,表示多个请求方法。

注:便捷注解传入路由路径path即可,可以省略键名path,无需传入methods

php8注解

四、示例

五、更新日志


All versions of webman-annotations with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
doctrine/annotations Version ^1.13
workerman/webman-framework Version ^1.3
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 shayvmo/webman-annotations contains the following files

Loading the files please wait ....