PHPackages                             leapt/slug-type-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. leapt/slug-type-bundle

ActiveSymfony-bundle

leapt/slug-type-bundle
======================

Leapt SlugType bundle makes a form field dynamically generate the slug of another text field.

v1.4.0(8mo ago)92.2k[1 issues](https://github.com/leapt/slug-type-bundle/issues)[1 PRs](https://github.com/leapt/slug-type-bundle/pulls)MITPHPPHP ^8.2CI passing

Since Feb 20Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/leapt/slug-type-bundle)[ Packagist](https://packagist.org/packages/leapt/slug-type-bundle)[ Docs](https://github.com/leapt/slug-type-bundle)[ RSS](/packages/leapt-slug-type-bundle/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (9)Dependencies (11)Versions (11)Used By (0)

Leapt SlugType bundle
=====================

[](#leapt-slugtype-bundle)

[![Package version](https://camo.githubusercontent.com/2ae08f804bbd0e4826bb21e57755be9bd4596640b2e1a05a938ee8d4acfe315e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c656170742f736c75672d747970652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/leapt/slug-type-bundle)[![Build Status](https://camo.githubusercontent.com/7210f9245d1074e88e61c1b38287d6206b336528487348d33befa0a8b406b2f5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c656170742f736c75672d747970652d62756e646c652f636f6e74696e756f75732d696e746567726174696f6e2e79616d6c3f6272616e63683d312e78267374796c653d666c61742d737175617265)](https://github.com/leapt/slug-type-bundle/actions?query=workflow%3A%22Continuous+Integration%22)[![PHP Version](https://camo.githubusercontent.com/e05ebbe5519aaa5386ff23f7cb2e53b6a77ef5929b42d05b4f113bdc4f95f07a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c656170742f736c75672d747970652d62756e646c652e7376673f6272616e63683d312e78267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/e05ebbe5519aaa5386ff23f7cb2e53b6a77ef5929b42d05b4f113bdc4f95f07a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c656170742f736c75672d747970652d62756e646c652e7376673f6272616e63683d312e78267374796c653d666c61742d737175617265)[![License](https://camo.githubusercontent.com/10e85a5778fe7601504a17ecd18dfa7097f473186b0f947bc10db2d3e4f530e4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d7265642e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Code coverage](https://camo.githubusercontent.com/ecd9087601c691053585862ddfbc4d1fbdd99ed41c7391dcc5e25278af5d1ab1/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6c656170742f736c75672d747970652d62756e646c653f7374796c653d666c61742d737175617265)](https://codecov.io/gh/leapt/slug-type-bundle/branch/1.x)

Leapt SlugType bundle makes a form field dynamically generate the slug based on the content of another text field.

[![Demo](demo.gif)](demo.gif)

Requirements
------------

[](#requirements)

- PHP ^8.2
- Symfony ^6.4, ^7.0 or ^8.0
- Webpack Encore &amp; Stimulus bridge already present in your project

Installation
------------

[](#installation)

```
composer require leapt/slug-type-bundle

# Don't forget to install the JavaScript dependencies as well and compile
npm install --force
npm run watch

# or use yarn
yarn install --force
yarn watch
```

Then, in your Twig configuration, add the form theme you want to apply:

```
# config/packages/twig.yaml
twig:
    form_themes:
        - '@LeaptSlugType/bootstrap5_layout.html.twig'
```

There are currently 3 form themes available:

- `@LeaptSlugType/basic_layout.html.twig`
- `@LeaptSlugType/bootstrap4_layout.html.twig`
- `@LeaptSlugType/bootstrap5_layout.html.twig`

Usage
-----

[](#usage)

In your form type, use the `SlugType` on the field that will handle the slug, and give it a `target` option that will be used to generate the slug:

```
