- How do I install the schmeits/filament-character-counter package in Laravel?
- Install it with Composer using composer require schmeits/filament-character-counter:^5.0. It requires PHP 8.2 or higher and Filament 4.x or 5.x. Optionally publish the translation file with php artisan vendor:publish --tag=filament-character-counter-translations. No migrations or service provider setup are required.
- Which Filament and Laravel versions does this character counter support?
- Version 5.x supports Filament 4.x and 5.x on PHP 8.2+, with CI coverage for Laravel 11 and 12. Older Filament 3.2 projects should use the 1.x release line. Pin ^5.0 in composer.json and commit your lockfile, and do not mix 1.x and 5.x in the same codebase.
- How do I add a live character counter to a Filament TextInput or Textarea?
- Replace the native Filament field import with the package's TextInput or Textarea component, then call characterLimit(50) for example. The counter updates live as the user types and can be placed inside the control with showInsideControl(true). You only need to opt in on the fields where you want the counter.
- What is the difference between characterLimit() and maxLength() in this package?
- characterLimit() adds a live counter and is effectively a soft UX limit, not a hard enforcement mechanism. maxLength() applies the hard maximum through the field's maxlength behavior and validation. You do not need both on the same field. For compliance or API constraints, still validate the value server-side with Laravel rules.
- Does the character counter work correctly with Filament's RichEditor?
- Yes, the package includes a RichEditor component, but this is the most fragile surface because counting is DOM-based against rendered editor content and uses a Livewire commit hook. RichEditor has needed fixes before and is the most likely area to break on Filament upgrades. Also verify what your server-side max rule counts for RichEditor, since stored HTML and visible text can differ.
- Is the character limit enforced server-side by this package?
- No, the counter is client-side UX feedback and should not be treated as enforcement. Use maxLength() where appropriate and always add Laravel validation for any hard limit. This matters for API constraints, compliance requirements, and any data that can be submitted outside the browser.
- How do I translate or customize the character counter label?
- Publish the translations with php artisan vendor:publish --tag=filament-character-counter-translations, then edit character_label and character_seperator. Be aware the published key contains a typo, character_seperator, so keep that spelling when overriding it. Locale QA for RTL, French, German, Dutch, or Arabic is your responsibility.
- Can I show the character counter inside the input control?
- Yes, chain showInsideControl(true) on the field alongside characterLimit(). This places the counter within the component rather than below it, which is useful for compact forms. It works with the package's TextInput, Textarea, and RichEditor components.
- Does this package work with Filament SPA mode and Livewire 3 or 4?
- The package claims support for Livewire 3 and 4 and has included fixes for async Alpine loading in SPA mode. Because the RichEditor counter depends on DOM structure and Livewire commit hooks, test it in your actual SPA panel before rollout. If your panel uses SPA navigation, include a quick create, edit, and refresh check in QA.
- Is schmeits/filament-character-counter safe to use in production?
- It is a small, low-blast-radius presentation package with no migrations or data model, so it is easy to fork or remove. The main risk is supplier concentration: it has a single maintainer and limited ecosystem validation. Pin the version, commit the lockfile, add it to your Filament major upgrade checklist, and define a fork trigger if upstream goes quiet.