slicesofcake / slug
CakePHP plugin for slugs
Installs: 128
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 2
Type:cakephp-plugin
Requires
- ext-mbstring: *
- cakephp/cakephp: ^4.0
This package is not auto-updated.
Last update: 2024-01-10 12:27:09 UTC
README
Automatic creation of friendly links based on indicated field.
Requirements
It's developed for CakePHP 4.x.
Installation
You can install plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require slicesofcake/slug
Load the Behavior
Load the behavior in /src/Model/Table/YourTable.php
.
public function initialize(array $config): void { // ... $this->addBehavior('SlicesCake/Slug.Slug'); }
You can configuration to customize the Slug plugin:
$this->addBehavior('SlicesCake/Slug.Slug', [ 'slug' => [ // Target field name of column to store slugs, default is slug 'source' => 'name', // Source field name to create slug, default is title 'replacement' => '_', // Default is - 'finder' => 'some', // You can build own custom finder method, like findSome, default is built-in list 'present' => true, // Rewrite slug, default is false, was added in 1.1.0 'method' => 'someOther', // You can build own method for create string slug, now default is built-in Text::slug, was added in 1.2.0 ], ]);