Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Splat Laravel Package

phlak/splat

Splat is a lightweight PHP library for matching strings against wildcard patterns. It provides simple, expressive helpers for route-style matching, capturing wildcard segments, and filtering paths or values, making it useful for routing, file matching, and other pattern-based tasks.

Deep Wiki
Context7

Glob-like file and pattern matching utility for PHP.

Frequently asked questions about Splat
What is phlak/splat used for in a Laravel application?
phlak/splat is described as a lightweight, framework-agnostic PHP library for matching strings against wildcard patterns, with helpers for route-style matching and filtering paths or values. In Laravel you would typically use it behind an application-owned adapter for upload path rules, log or asset filtering, cache invalidation patterns, import/export selection, and include or exclude lists. It is not a Laravel filesystem or routing component, so keep it in infrastructure code rather than domain logic. The supplied overview also mentions array helpers, so verify the actual public API before adopting it.
How do I install phlak/splat in a Laravel project with Composer?
Install it with Composer, for example composer require phlak/splat, and pin a minor version in composer.json for predictable upgrades. Because the repository reference is unknown in the supplied metadata, confirm the exact Packagist package name and latest release before committing. Then create a small adapter or service class and bind it in Laravel's service container instead of calling the package directly from controllers, jobs, or domain services.
Does phlak/splat support Laravel 10, 11, or 12 and which PHP versions?
phlak/splat is described as framework-agnostic and Composer-ready, so it does not appear to ship Laravel-specific integrations; Laravel compatibility mainly depends on its PHP version constraint. Check Packagist and the project CI matrix for the officially supported PHP versions before adding it to a Laravel 10, 11, or 12 application. If your application runs an older PHP version, confirm support or keep a native fnmatch or glob fallback behind your adapter.
How is phlak/splat different from PHP fnmatch and glob?
The package is positioned as a focused helper library for matching strings against wildcard patterns, similar in spirit to fnmatch-style string matching and glob-like path selection. Native fnmatch and glob are built into PHP but have platform-specific quirks, especially around path separators, dotfiles, brace expansion, and recursive patterns. Treat phlak/splat as a convenience layer only after comparing its documented semantics with native PHP behavior on your target operating systems.
Does phlak/splat support double-star recursion, braces, character classes, and Windows path separators?
The supplied metadata does not confirm the exact pattern syntax, so verify support for double-star recursion, brace expansion, character classes, escaping, dotfiles, and Windows separators in the package documentation and tests. Run a short spike with representative patterns on Linux, macOS, and Windows if those environments are in scope. Normalize directory separators and document case sensitivity at your adapter boundary so behavior stays consistent across platforms.
Can untrusted phlak/splat patterns cause performance or security problems?
Any wildcard matcher that compiles patterns to regular expressions can be exposed to excessive CPU use or backtracking if users supply arbitrary patterns. Restrict user-supplied patterns with allowlists, length limits, and validation, and avoid matching against unbounded path lists in request paths. Benchmark realistic worst-case patterns and cache compiled patterns if the package exposes that capability; otherwise keep the adapter thin and replaceable.
How should I integrate phlak/splat into a Laravel application architecture?
Wrap it in an internal interface such as PathMatcher with methods like matches(string $pattern, string $path): bool and filter(array $patterns, array $paths): array. Bind that interface in Laravel's service container and inject it into infrastructure services, not domain models or controllers. Keep a native fnmatch or glob fallback behind the same contract so you can swap the package without changing call sites.
How do I test phlak/splat matching behavior in Laravel?
Write contract tests for your adapter covering representative patterns and paths, including dotfiles, nested directories, trailing slashes, mixed separators, case differences, and recursive wildcards. Compare results against native fnmatch or glob where semantics permit, and document intentional deviations from PHP behavior. Add feature tests around one low-risk Laravel use case, such as log selection or asset filtering, before expanding to higher-risk paths.
Is phlak/splat production-ready and actively maintained?
It is described as a focused, Composer-installable MIT library, but the supplied metadata shows a modest community footprint and an unknown repository reference, so treat it as a tactical dependency rather than a strategic platform component. Check release cadence, CI coverage, issue activity, and security advisories before production adoption. Pin the version, assign an internal owner for the adapter and contract tests, and run Composer audit as part of dependency review.
What are alternatives to phlak/splat for wildcard matching in Laravel?
Native PHP fnmatch and glob are the simplest alternatives for basic wildcard and filesystem matching. Laravel's Str::is helper can handle simple wildcard string comparisons, and Symfony Finder is suitable when you need richer filesystem traversal. Keep phlak/splat only if its syntax and ergonomics clearly beat these options behind your adapter.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager