Download the PHP package jourdon/sluggable without Composer

On this page you can find all versions of the php package jourdon/sluggable. 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 sluggable

laravel-Sluggable

Latest Stable Version Total Downloads Latest Unstable Version License

说明

我的博客有很多文章,很多分类,他们的链接是这样的

这看起来非常不友好,我希望将后面的id换成文章的村里或者分类的名称,这样看起来比较友好,从链接就能看出来文章的内容,对搜索引擎也比较友好,像这样:

你只需要安装本扩展包,你不需要另外做什么,它会自动帮你搞定,可以根据你的Eloquent模型生成相应的slug,让你的url更加的友好。

要求

安装

1、 使用 Composer 安装:

2、 配置

本扩展包本身不需要配置文件,也无需配置,但本扩展包依赖于 laravel-slug ,所以需要导出laravel-slug 的配置文件,具体请前往 laravel-slug 查看并配置。

3、 添加Slug字段

你的数据表中需要有slug字段,执行下面的命令生成迁移文件,以Post模型为例:

4、 运行迁移

如果你的数据表中已经有slug字段,请忽略 3,4

5、将Eloquent模型的slug加入缓存,注意这里,Laravel默认的Model目录在app下,假如你的Eloquent模型都放在app/models目录下,你需要在Eloquent模型前加上Models/

使用

还是以Post模型为例,我们需要使用SlugTrait

如果你还需要将Category的URL也变得这么漂亮,只需要重复3,4,5即可。

OK. 已经完成了,去看看你的链接吧,


All versions of sluggable with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version ~5.5
jourdon/slug Version ^1.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 jourdon/sluggable contains the following files

Loading the files please wait ....