integrated / slug-bundle
Provides a slugger which can generate a slug from a string and event listeners to auto-generate slugs on chosen fields
Installs: 3 274
Dependents: 3
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.4
- jms/metadata: ~1.5
- symfony/polyfill-iconv: ~1.0
- symfony/symfony: ~2.8 || ~3.0
Requires (Dev)
- phpunit/phpunit: ^5.7
- squizlabs/php_codesniffer: ^2.8
This package is not auto-updated.
Last update: 2024-11-09 17:45:37 UTC
README
Provides a slugger which can generate a slug from a string and event listeners to auto-generate slugs on chosen fields
Requirements
- See the require section in the composer.json
Documentation
Installation
This bundle can be installed following these steps:
Install using composer
$ php composer.phar require integrated/slug-bundle:~0.3
Enable the bundle
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Integrated\Bundle\SlugBundle\IntegratedSlugBundle()
// ...
);
}
Example
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Integrated\Bundle\SlugBundle\Mapping\Annotations\Slug;
class Article
{
/**
* @var string
* @ODM\String
*/
protected $title;
/**
* @var string
* @ODM\String
* @Slug(fields={"title"})
*/
protected $slug;
...
}
Multiple fields
@Slug(fields={"title", "anotherField"})
Custom seperator
@Slug(fields={"title"}, seperator="_")
Custom method to generate slug
@Slug(fields={"getSlug"})
License
This bundle is under the MIT license. See the complete license in the bundle:
LICENSE
Contributing
Pull requests are welcome. Please see our CONTRIBUTING guide.
About
This bundle is part of the Integrated project. You can read more about this project on the Integrated for developers website.