Download the PHP package ommu/yii-sluggable without Composer
On this page you can find all versions of the php package ommu/yii-sluggable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download ommu/yii-sluggable
More information about ommu/yii-sluggable
Files in ommu/yii-sluggable
Download ommu/yii-sluggable
More information about ommu/yii-sluggable
Files in ommu/yii-sluggable
Vendor ommu
Package yii-sluggable
Short Description Make a unique url out of one or more db fields
License Apache-2.0
Homepage https://github.com/ommu/ext-sluggable
Package yii-sluggable
Short Description Make a unique url out of one or more db fields
License Apache-2.0
Homepage https://github.com/ommu/ext-sluggable
Please rate this library. Is it a good library?
Informations about the package yii-sluggable
What's it all about?
With this behavior, you can generate an URI for a single or combination of columns in your table. Some call it permalink, others call it slug or human readable url.
Check out the latest version at: github.com/mintao/yii-behavior-sluggable
Imagine a blog table
| id | category | title | |----+----------+-----------------------------------| | 1 | security | NASA Server hacked by hacker kids | | ...
So you'd like a better URL than that?
http://your-blog.org/index.php?r=blog/show&id=1422
What about
http://your-blog.org/security/nasa-server-hacked-by-hacker-kids
Google will love you ;)
How to get it done
- Add another column called "slug" to your table
- Download this extension and drop it into your protected/extensions folder,
- Add the behavior to your model (shown below)
If you're using git, I'd recommend:
cd <YOUR YII-PROJECT> mkdir -p protected/extensions/behaviors (optional) git submodule add git://github.com/mintao/yii-behavior-sluggable.git protected/extensions/behaviors/SluggableBehavior
Demo configuration of this behavior for your model
/** * Behaviors for this model */ public function behaviors(){ return array( 'sluggable' => array( 'class'=>'ext.yii-sluggable.SluggableBehavior', 'columns' => array('category', 'title', 'author.name'), 'unique' => true, 'update' => true, ), ); }
- class Defines the path where to find the SluggableBehavor.php
- columns Needs to be an array of the fields to use for slug creation
- unique Set this to true to ensure a unique slug (Numbers will be added to duplicate slugs, if already existing)
- update Set this to true is every time you change the entry, the slug should be updated too. Set it to false, if the slug should be only created once
Download this extension (and fork it):
github.com/mintao/yii-behavior-sluggable
Changelog
- 2014-08-25 Slight speed improvement
- 2011-04-30 Added update functionality
- 2011-06-23 Added support for dependent models (see demo configuration, author.name)
All versions of yii-sluggable with dependencies
PHP Build Version
Package Version
Requires
php Version
>=5.3.2
oomphinc/composer-installers-extender Version ^1.0
yiisoft/yii Version >=1.1.14
oomphinc/composer-installers-extender Version ^1.0
yiisoft/yii Version >=1.1.14
The package ommu/yii-sluggable contains the following files
Loading the files please wait ....