Download the PHP package cshaptx4869/thinkphp-annotation without Composer

On this page you can find all versions of the php package cshaptx4869/thinkphp-annotation. 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 thinkphp-annotation

thinkphp-annotation

前言:

thinkphp5.1中用注解的方式实现:

最新文档地址:https://www.cnblogs.com/cshaptx4869/p/12178960.html

安装

配置

tags.php添加行为,用于控制器注解扫描

模型中使用属性注解的话,需要在模型中引入 \Fairy\ModelAnnotationScaner 的trait

添加 system.php 配置文件(可选)

PS:默认验证器注解验证不通过会终止程序运行并返回json格式的验证错误信息。可通过配置 callback函数自定义后续处理。请注意,不同版本使用上会有些许差别。

支持的注解

v0.1.0版:
注解名 申明范围 作用
@Autowire 属性 自动注入类对象
@DynamicAutowire 方法 声明当前方法允许属性注入的类
@IgnoreAutowire 方法 声明当前方法忽略属性注入的类
@RequestParam 方法 过滤、格式化请求参数
@Validator 方法 验证器验证
v0.1.1版:
注解名 申明范围 作用
@RequestParam 方法 过滤、格式化请求参数
@Validator 方法 验证器验证
@Autowire 属性 自动注入类对象
@Transaction 方法 自动事务

版本差异:

v0.1.1新增:

Transaction 注解

Transaction 注解根据当前方法返回值自动判断事务后续处理,如返回值等价于true就会自动commit,否则rollback。

Transaction 注解需要搭配 Autowire注解使用,且不支持在控制器中使用,推荐在模型中使用。

ModelAnnotationScaner

支持模型中使用属性注解

Autowire 注解改动:

v0.1.0 版本中 Autowire 注解必须写class属性,如 Autowire(class=ArticleModel::class),而在v0.1.1版本中 Autowire 注解则没有class属性而是通过@var ArticleModel 注解来自动识别。

v0.1.0版本使用示例

ArticleController 控制器:

v0.1.1版本使用示例

ArticleController 控制器:

ArticleModel 模型:

IDE 注解插件支持

一些ide已经提供了对注释的支持,推荐安装,以便提供注解语法提示


All versions of thinkphp-annotation with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
ext-json Version *
topthink/framework Version 5.1.*
doctrine/annotations Version 1.4.0
nikic/php-parser Version v3.1.5
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 cshaptx4869/thinkphp-annotation contains the following files

Loading the files please wait ....