Add files via upload

这个提交包含在:
小小白哦
2026-07-25 10:43:03 +08:00
提交者 GitHub
父节点 37f61cd22a
当前提交 5b7602b850
修改 4 个文件,包含 111 行新增3 行删除
+1 -1
查看文件
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2026 小小白哦
Copyright (c) 2021 Pipecraft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+43 -2
查看文件
@@ -1,2 +1,43 @@
# id-slug
Use id as the slug in the discussion URL.
# ID Slug
[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Xiaoxiaobai5724/id-slug/blob/2.x/LICENSE.md) [![Latest Stable Version](https://img.shields.io/packagist/v/Xiaoxiaobai5724/id-slug.svg)](https://packagist.org/packages/Xiaoxiaobai5724/id-slug) [![Total Downloads](https://img.shields.io/packagist/dt/Xiaoxiaobai5724/id-slug.svg)](https://packagist.org/packages/Xiaoxiaobai5724/id-slug)
---
A [Flarum](https://flarum.org) extension. Use `id` as the `slug` in the discussion URL.
- AS-IS:
- http://exmaple.com/d/123-hello-world
- http://exmaple.com/d/123-hello-world/3
- TO-BE:
- http://exmaple.com/d/123
- http://exmaple.com/d/123/3
### Installation
```sh
composer require xxb/id-slug
```
> **Migrating from pipecraft/flarum-ext-id-slug**
This extension was transferred to XXB and was previously published as `pipecraft/flarum-ext-id-slug`. The XXB line begins at **2.0.0**, continuing the version history (the previous package reached 1.1.0).
For forum admins, migration is a one-line change — swap the package, keep your settings and stored SEO data:
```sh
composer remove pipecraft/flarum-ext-id-slug
composer require xxb/id-slug
php flarum cache:clear
```
### Updating
```sh
composer update xxb/id-slug
```
### How to Use
1. Install extension
2. Enable **ID Slug** extension
3. Basics > Slug Driver(Discussion) > Select **id** slug driver
### Notice
- If you are using the sitemap(fof/sitemap) extension, you need to upgrade to v1.0.1 or above. [Use Slug Driver system properly](https://github.com/FriendsOfFlarum/sitemap/issues/30)
+46
查看文件
@@ -0,0 +1,46 @@
{
"name": "xxb/id-slug",
"description": "A Flarum 2.0 extension. Use id as slug in discussion URL.",
"keywords": [
"id",
"slug",
"slug-driver"
],
"type": "flarum-extension",
"license": "MIT",
"authors": [
{
"name": "Pipecraft",
"email": "pipecraft.net@gmail.com"
},
{
"name": "Xiaoxiaobai5724",
"email": "odoorbell@163.com",
"role": "Developer"
}
],
"support": {
"issues": "https://github.com/Xiaoxiaobai5724/id-slug/issues",
"source": "https://github.com/Xiaoxiaobai5724/id-slug"
},
"homepage": "https://github.com/Xiaoxiaobai5724",
"require": {
"flarum/core": "^2.0.0"
},
"autoload": {
"psr-4": {
"XXB\\IdSlug\\": "src/"
}
},
"extra": {
"flarum-extension": {
"title": "XXB ID Slug",
"category": "feature",
"icon": {
"name": "fas fa-info",
"backgroundColor": "#00bfff",
"color": "#fff"
}
}
}
}
+21
查看文件
@@ -0,0 +1,21 @@
<?php
/*
* This file is part of Xiaoxiaobai5724/id-slug.
*
* Copyright (c) XXB.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace XXB\IdSlug;
use Flarum\Discussion\Discussion;
use Flarum\Extend;
use XXB\IdSlug\Discussion\IdSlugDriver;
return [
(new Extend\ModelUrl(Discussion::class))
->addSlugDriver('id', IdSlugDriver::class)
];