PHP code example of martin-ro / filament-charcount-field
1. Go to this page and download the library: Download martin-ro/filament-charcount-field library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
martin-ro / filament-charcount-field example snippets
use MartinRo\FilamentCharcountField\Components\CharcountedTextInput;
CharcountedTextInput::make('title')
->minCharacters(5)
->maxCharacters(10),
use MartinRo\FilamentCharcountField\Components\CharcountedTextarea;
CharcountedTextarea::make('title')
->minCharacters(5)
->maxCharacters(10),
namespace App\Filament\Resources;
// ...
use MartinRo\FilamentCharcountField\Components\CharcountedTextInput;
use MartinRo\FilamentCharcountField\Components\CharcountedTextarea;
class PostResource extends Resource
{
// ...
public static function form(Form $form): Form
{
return $form->schema([
// ...
// TextInput
CharcountedTextInput::make('title')
->label('Title')
->hintIcon('heroicon-o-code')
->hint('Title tag in header')
->helperText('While Google does not specify a length for title tags, usually the first 50–60 characters are displayed.')
->minCharacters(50)
->maxCharacters(60),
// Textarea
CharcountedTextarea::make('description')
->label('Description')
->rows(4)
->hintIcon('heroicon-o-code')
->hint('Meta description tag in header')
->helperText('Meta descriptions can technically be any length, but Google generally truncates snippets to ~155-160 characters.')
->minCharacters(155)
->maxCharacters(160),
// ..
]);
}
// ...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.