diff --git a/LICENSE b/LICENSE index 9974d59..f627adc 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/README.md b/README.md index c08bffb..1bd5993 100644 --- a/README.md +++ b/README.md @@ -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)) \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..0853543 --- /dev/null +++ b/composer.json @@ -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" + } + } + } +} diff --git a/extend.php b/extend.php new file mode 100644 index 0000000..3f60e8d --- /dev/null +++ b/extend.php @@ -0,0 +1,21 @@ +addSlugDriver('id', IdSlugDriver::class) +];