Download the PHP package lartrix/thinkphp-route-priority without Composer

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

ThinkPHP 8 Route Priority Patch

这个 Composer 包用于修复 ThinkPHP 8 路由的声明顺序遮挡问题:

安装

如果希望安装或更新 Composer 依赖后自动刷新 ThinkPHP 服务发现,请在宿主项目的 composer.json 增加:

之后执行 composer require lartrix/thinkphp-route-priority 时会自动生成 vendor/services.php,无需再手动执行 php think service:discover

如果你的项目没有自动发现服务,也可以手动在 app/provider.php 中绑定:

使用

安装并发现服务后,原来的路由文件无需改写:

访问 /path/you 时会优先选择静态且更具体的 /path/you,不会被前面的 /path/<id>/path 覆盖。

工作方式

包会把 ThinkPHP 容器里的 route 服务替换为自定义 Route,并让默认域名、域名路由、普通分组在匹配前按“更具体的规则优先”排序:

  1. 静态片段更多的规则优先;
  2. 动态变量更少的规则优先;
  3. 路径更长、更具体的规则优先;
  4. 同等优先级保持原声明顺序。

验证

在本包目录运行:

注意

这个补丁面向 ThinkPHP topthink/framework:^8.0。如果你的项目已经自定义绑定了 route 服务,请合并本包的 Route 继承逻辑,或确保最终绑定到 Lartrix\ThinkPHPRoutePriority\Route


All versions of thinkphp-route-priority with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
topthink/framework 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 lartrix/thinkphp-route-priority contains the following files

Loading the files please wait ...