joomla/filter
joomla/filter provides input and output filtering tools for PHP apps, helping sanitize content by allowing or blocking specific HTML tags and attributes. Includes OutputFilter helpers (e.g., URL-safe strings; optional Joomla\Language).
e() helper, Illuminate\Validation\Rules\Sanitize, and packages like htmlpurifier/htmlpurifier already address HTML sanitization. This package introduces redundancy unless Joomla-specific filtering rules (e.g., OutputFilter::stringURLSafe) are explicitly required.javascript:, data: URIs, and evasion characters) but lacks Laravel-native features like request validation pipelines or middleware integration.Joomla\Language dependency for stringURLSafe creates unnecessary coupling for Laravel apps not using Joomla components.<b>, <i> but block <script>).TAGS_WHITELIST → ONLY_ALLOW_DEFINED_TAGS).e()).stringURLSafe)?htmlpurifier/htmlpurifier?e() or strip_tags()?Joomla\Language package introduce bloat or conflicts?mbstring)?use Joomla\Filter\InputFilter;
use Illuminate\Validation\Rule;
public function rules()
{
return [
'comment' => [
'required',
Rule::custom(function ($attribute, $value, $fail) {
$filter = new InputFilter();
$filtered = $filter->clean($value, InputFilter::ONLY_ALLOW_DEFINED_TAGS, ['p', 'b', 'i']);
// Compare or return filtered value
}),
],
];
}
namespace App\Http\Middleware;
use Joomla\Filter\InputFilter;
use Closure;
class SanitizeInput
{
public function handle($request, Closure $next)
{
$filter = new InputFilter();
$request->merge([
'input_field' => $filter->clean($request->input_field, InputFilter::ONLY_ALLOW_DEFINED_TAGS, ['a']),
]);
return $next($request);
}
}
$this->app->singleton(InputFilter::class, function ($app) {
return new InputFilter();
});
laravel-joomla-filter) to abstract Joomla dependencies.e() for general escaping.e() and strip_tags().strip_tags() calls with InputFilter where configurable whitelisting is needed.htmlpurifier/htmlpurifier or Laravel’s native tools.joomla/language if stringURLSafe is used.htmlpurifier/htmlpurifier (duplicate sanitization).~3.0 for stability).3.0.6) to avoid breaking changes.composer why-not joomla/filter to check for conflicts.Joomla\Language dependency warnings.strip_tags as a fallback)."><script>).e() and strip_tags() for high-traffic endpoints.InputFilter instances in service containers (Laravel’s DI).| **Failure Scenario
How can I help you explore Laravel packages today?