- Does mindy/orm-slug-field work with Laravel or Eloquent?
- No. It is a custom field-type extension for the MindyPHP ORM and has no Illuminate dependencies, service provider, or Laravel auto-discovery metadata. Laravel applications cannot use it as a drop-in dependency; the realistic option is to borrow the slug-generation pattern and implement it with an Eloquent trait or observer instead.
- What does mindy/orm-slug-field actually do?
- It registers SlugField and AutoSlugField field types for the MindyPHP ORM. These derive a URL-friendly slug, typically from a title or name column, at the persistence layer so model code does not need to call slugify manually. It also advertises configurable source fields and uniqueness handling.
- How do I install and configure mindy/orm-slug-field in a MindyPHP project?
- Install it with Composer, register the field type in your Mindy ORM bootstrap, and apply the slug field configuration to a model. Because the package has minimal external validation, consider vendoring it into packages/ and pinning an explicit commit SHA rather than relying on Packagist. Start with one low-traffic model before rolling it out further.
- Does the slug regenerate automatically when the title changes?
- This behavior is not documented in the available information and is flagged as unknown. The package likely includes an update-on-change trigger, but you should verify it in the source before relying on it. If stable URLs matter for SEO, design an opt-out so edits to the source field do not silently change existing slugs.
- How does it handle duplicate slugs and uniqueness?
- The package claims uniqueness handling, but the exact collision strategy is not documented; it could use numeric suffixes, hashes, or another approach. There is also no test evidence confirming correctness under concurrent writes. Treat a database unique index as the real guard and test duplicate creation explicitly.
- Is mindy/orm-slug-field safe to use in production?
- Treat it with caution. It has 1 star, 0 dependents, a single maintainer, no issue traffic, and no visible test suite, so assume it is effectively unmaintained. The concept is simple and portable, but the package itself is better treated as a reference implementation than a production dependency.
- What are better Laravel alternatives for automatic slug generation?
- For Laravel, use spatie/laravel-sluggable or cviebrock/eloquent-sluggable. Both are mature, Eloquent-native packages with active maintenance and established handling for slug sources, uniqueness, and regeneration. Recommending either over mindy/orm-slug-field is the correct choice for a Laravel codebase.
- How would I port the slug behavior to Laravel Eloquent?
- Add a HasSlug trait with properties such as slugSource, slugColumn, and slugSeparator. Hook the saving event to generate a slug only when it is empty or the source field changed, with a configurable opt-out to keep URLs stable. Implement collision suffixing as an indexed lookup loop and rely on a database unique constraint as the final guard, then test Unicode, duplicates, empty sources, and long titles. This is roughly half a day of work and avoids shimming a foreign ORM.
- How does it handle Unicode, CJK, or other non-ASCII titles?
- The transliteration behavior is unknown from the available information. Key questions include how non-ASCII characters are converted and what happens when transliteration produces an empty string. Test these cases before relying on the package, and consider a dedicated transliteration library with an explicit fallback.
- Which PHP versions does mindy/orm-slug-field support, and will it work on PHP 8.2 or 8.3?
- The available information does not declare a PHP version floor or CI coverage. A package of this vintage may not officially support PHP 8.2 or 8.3 and could emit deprecation warnings. Check its composer.json and test it against your runtime before adopting it.