Download the PHP package kingbes/attribute without Composer

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

KingBes/Attribute

🚀 基于 webman 的 PHP 8 原生 Attribute(注解)路由方案,通过注解声明路由、中间件、权限标识、视图标识等信息。

环境要求

安装

快速开始

在控制器类或方法上添加 #[Annotation(...)] 注解,数组键值使用 => 语法。

注解参数

#[Annotation(array $data)] 支持以下键:

类型 必须 说明
title string 标题标识,用于权限/视图等场景
path string[] 自定义路由路径。为空时自动使用类名 + 方法名生成路由
request string[] 允许的 HTTP 方法,见下方默认值
middleware string[] 路由中间件,默认 []
auth bool 权限标识
name string 自定义路由名(webman ->name()),可覆盖默认名

默认值

自定义路由名

name 用于设置 webman 路由名(->name()),可在模板中通过 {:route("路由名")} 反查生成 URL,无需手写路径。指定后覆盖该方法的默认路由名:

可重复注解

同一目标(类或方法)可声明多个 #[Annotation],重复注解会合并:

注解信息

通过 Data 类获取全部注解信息:

路由规则

index 路由别名

index 方法除完整路径外,会自动注册一个去掉末尾连续 index 段的别名路径:

控制器 完整路径 别名路径
IndexController::index(单应用根) /index/index /
默认 index 应用 IndexController::index /index/index/index /
admin 应用 IndexController::index /admin/index/index /admin
AboutController::index /about/index /about
user 应用 AboutController::index /user/about/index /user/about

规则:从完整路径末尾依次去掉 /index 段,直到不剩或剩余非 index 段。如 /admin/index/index/admin/index/index/index/。如需自定义别名行为,可在 index 方法上用 path 显式指定。

测试

在 webman 项目中用 route:list 命令查看注解生成的路由:

启动服务后逐个访问验证:

检查点:

限制


All versions of attribute with dependencies

PHP Build Version
Package Version
Requires php Version >8.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 kingbes/attribute contains the following files

Loading the files please wait ...