@@ -9,14 +9,20 @@ Slugging for CakePHP 3.x
99
1010## Requirements
1111
12- - CakePHP 3.0+
12+ - CakePHP 3.2.7+ (for lower CakePHP versions use plugin version 1.0. * )
1313
1414## Installation
1515
1616Using [ Composer] [ composer ] :
1717
1818``` bash
19- composer require muffin/slug:~ 1.0
19+ composer require muffin/slug
20+ ```
21+
22+ or if your CakePHP is less than 3.2.7 use
23+
24+ ``` bash
25+ composer require muffin/slug:1.0.*
2026```
2127
2228To make your application load the plugin either run:
@@ -38,10 +44,10 @@ To enable slugging add the behavior to your table classes in the
3844``` php
3945public function initialize(array $config)
4046{
41- //etc
42- $this->addBehavior('Muffin/Slug.Slug', [
43- // Optionally define your custom options here (see Configuration)
44- ]);
47+ //etc
48+ $this->addBehavior('Muffin/Slug.Slug', [
49+ // Optionally define your custom options here (see Configuration)
50+ ]);
4551}
4652```
4753
@@ -77,9 +83,32 @@ Slug comes with the following configuration options:
7783- ` implementedEvents ` : events this behavior listens to.
7884- ` implementedFinders ` : custom finders implemented by this behavior.
7985- ` implementedMethods ` : mixin methods directly accessible from the table.
80- - ` onUpdate ` : Boolean indicating whether slug should be updated when updating
86+ - ` onUpdate ` : Boolean indicating whether slug should be updated when updating
8187 record, defaults to ` false ` .
8288
89+ ## Sluggers
90+
91+ The plugin contains two sluggers:
92+
93+ ### CakeSlugger
94+
95+ The ` CakeSlugger ` uses ` \Cake\Utility\Text::slug() ` to generate slugs. In the
96+ behavior config you can set the ` slugger ` key as shown below to pass options to
97+ the ` $options ` arguments of ` Text::slug() ` .
98+
99+ ``` php
100+ 'slugger' => [
101+ 'className' => 'Muffin\Slug\Slugger\CakeSlugger',
102+ 'transliteratorId' => '<A valid ICU Transliterator ID here >'
103+ ]
104+ ```
105+
106+ ### ConcurSlugger
107+
108+ The ` ConcurSlugger ` uses [ concur/slugify] ( https://github.com/cocur/slugify ) to generate slugs.
109+ You can use config array similar to the one shown above to pass options to
110+ ` Cocur\Slugify\Slugify ` 's constructor.
111+
83112## Patches & Features
84113
85114* Fork
@@ -100,10 +129,6 @@ ln -s ../../contrib/pre-commit .git/hooks/.
100129
101130http://github.com/usemuffin/slug/issues
102131
103- ## Credits
104-
105- This was originally inspired by @dereuromark 's [ ` SluggedBehavior ` ] ( https://github.com/dereuromark/cakephp-tools/blob/cake3/src/Model/Behavior/SluggedBehavior.php ) .
106-
107132## License
108133
109134Copyright (c) 2015, [ Use Muffin] [ muffin ] and licensed under [ The MIT License] [ mit ] .
0 commit comments