Download the PHP package liufencn/flarum-short-slug without Composer

On this page you can find all versions of the php package liufencn/flarum-short-slug. 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 flarum-short-slug

Short Slug for Flarum 2.x

Rewrite discussion URLs from /d/{id}-pinyin-slug to the bare /d/{id} form.

Flarum builds every discussion URL out of its title — Str::slug($title, '-', default_locale) — which is fine for English titles but produces long, unreadable URLs for languages that are not written in Latin characters. A Chinese title such as Qoder 默认设置 becomes /d/248-qoder-mo-ren-she-zhi.

This extension drops that slug right before the discussion is saved, so the URL stays short: /d/248. Nothing else changes, and no core or vendor file is touched — it is a pure event listener.

Existing links keep working: Flarum resolves /d/{id} by the numeric ID first, so old URLs that still carry a slug continue to redirect correctly.

Features

Installation

Then enable it in the admin panel, or run:

Finally, clean up the discussions that already exist:

The cleanup command is safe to run at any time. Old URLs containing a slug keep resolving, because the numeric ID is always enough.

Usage

Rewriting existing discussions

Custom slugs

A discussion can keep a readable slug if you want one — useful for pinned or documentation-style discussions:

Users who are allowed to rename a discussion can also do it over the API, by sending a slug attribute in the request body:

Send an empty string to force the short form for that discussion. The slug attribute is read-only in Flarum's JSON:API schema, so this extension reads it from the raw request body — permission to rename the discussion is required.

When the Allow custom slugs toggle is off, every discussion — including ones with a hand-written slug — is pushed back to /d/{id}.

Comments on slugs

License

AGPL-3.0-or-later — see LICENSE.

You are free to use, modify and self-host this extension, including commercially, as long as any modified version you make available to others — including as a network service — is released under the same license. If you need to ship a modified, closed-source version, contact the author for a commercial license.


中文说明

把讨论链接从 /d/248-qoder-mo-ren-she-zhi 缩短为 /d/248。

Flarum 核心会自动用标题生成 slug(中文标题会变成拼音),本扩展在保存前把自动生成的 slug 清空,因此链接只剩数字 ID。不修改任何核心或 vendor 文件,纯事件监听。

装好后执行一次 php flarum short-slug:clear 即可把已有讨论一并变短。旧链接不会失效, 因为 Flarum 解析讨论地址时只依赖数字 ID。

需要个别讨论保留可读地址时,用 php flarum short-slug:set <ID> <slug> 单独设置, 或在后台关闭「允许自定义 slug」以强制全站使用 /d/{id}。

许可为 AGPL-3.0-or-later:可自由使用、修改、商用;但若你修改后对外提供服务, 必须以相同许可开源你的改动。需要闭源商用请联系作者获取商业授权。


联系作者 / Contact

渠道 地址
🏝️ 论坛(CatIsland) https://bbs.cathi.cn
💬 QQ 交流群 369748859
📮 邮箱 [email protected]

All versions of flarum-short-slug with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
flarum/core Version ^2.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 liufencn/flarum-short-slug contains the following files

Loading the files please wait ...