jeffersongoncalves / laravel-topic-normalizer
A tiny Laravel helper that merges raw topic/keyword lists (GitHub topics, composer.json + package.json keywords, Packagist keywords, …) into one slugged, deduplicated, length-filtered and capped list.
Package info
github.com/jeffersongoncalves/laravel-topic-normalizer
pkg:composer/jeffersongoncalves/laravel-topic-normalizer
Fund package maintenance!
Requires
- php: ^8.2
- illuminate/contracts: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
- spatie/laravel-package-tools: ^1.14
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- orchestra/testbench: ^9.0|^10.0|^11.0
- pestphp/pest: ^3.7.4|^4.0
- pestphp/pest-plugin-laravel: ^3.0|^4.0
This package is auto-updated.
Last update: 2026-06-22 00:19:26 UTC
README
Laravel Topic Normalizer
Merge raw topic / keyword lists from several sources — GitHub topics, composer.json + package.json keywords, Packagist keywords — into one clean list: slugged, deduplicated, length-filtered and capped.
Installation
composer require jeffersongoncalves/laravel-topic-normalizer
Usage
use JeffersonGoncalves\TopicNormalizer\TopicNormalizer; $topics = TopicNormalizer::normalize( $repo['topics'] ?? [], // GitHub topics $composer['keywords'] ?? [], // composer.json $packageJson['keywords'] ?? [], // package.json ); // => ['laravel', 'filament', 'php-package', …] (slugged, unique, max 20)
Pass any number of lists. Non-strings are skipped; values are Str::slug()-ed, empties and over-long slugs dropped, duplicates removed, and the result capped.
Configuration
php artisan vendor:publish --tag="topic-normalizer-config"
| Key | Default | Description |
|---|---|---|
max |
20 |
Maximum number of topics returned. |
max_length |
50 |
Slugs longer than this are dropped as junk. |
Testing
composer test
License
The MIT License (MIT). Please see License File for more information.
