PHPackages                             overxue/slug - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. overxue/slug

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

overxue/slug
============

中文的 url slug

1.0.0(8y ago)319MITPHPPHP &gt;=7.0

Since Apr 28Pushed 8y agoCompare

[ Source](https://github.com/overxue/slug)[ Packagist](https://packagist.org/packages/overxue/slug)[ RSS](/packages/overxue-slug/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Slug
====

[](#slug)

中文的 url slug 支持，目的是实现文章和帖子中文标题也可以使用 slug 类型的 url（目前只支持laravel框架中使用）

安装
--

[](#安装)

这是一个标准的 Composer 包,你可以直接通过下面的命令行来安装:

```
$ composer require "overxue/slug"
```

在laravel中使用
-----------

[](#在laravel中使用)

1. 在`config/services.php`中添加：

```
'baidu' => [
      'appId' => env('BAIDU_APP_ID'),
      'appKey' => env('BAIDU_APP_KEY')
  ],
```

在`.env`文件中添加 [百度开放平台](http://api.fanyi.baidu.com/api/trans/product/desktop?req=developer) 中申请的appid和秘钥(不配置appid和秘钥，程序会自动使用汉字转拼音方案来生成 Slug)

```
BAIDU_APP_ID=APP ID
BAIDU_APP_KEY=密钥

```

2. 使用

```
app('slug')->translate('如何翻译laravel文档');
// how-to-translate-laravel-documents
// 不配置秘钥和appid返回     ru-he-fan-yi-laravel-wen-dang

或者

use Overxue\Slug\Slug;

$slug = new Slug(config('services.baidu'));
$slug->translate('如何翻译laravel文档');
// how-to-translate-laravel-documents
```

License
-------

[](#license)

MIT

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2939d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8707de2c3eb7ed1aec839a63ecaea8870299b99af846818ba4a4e7aa7e45cdc4?d=identicon)[overxue](/maintainers/overxue)

---

Top Contributors

[![overxue](https://avatars.githubusercontent.com/u/31536685?v=4)](https://github.com/overxue "overxue (9 commits)")

---

Tags

laravellaravel-slugslugslugsdk

### Embed Badge

![Health badge](/badges/overxue-slug/health.svg)

```
[![Health](https://phpackages.com/badges/overxue-slug/health.svg)](https://phpackages.com/packages/overxue-slug)
```

###  Alternatives

[infusionsoft/php-sdk

PHP SDK for the Infusionsoft

1292.1M7](/packages/infusionsoft-php-sdk)[corley/influxdb-sdk

Send your app metrics to InfluxDB

84296.5k2](/packages/corley-influxdb-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
