jackiedo/path-helper
PHP helper for working with local filesystem paths. Normalize directory separators, restyle paths for Unix/Windows/current OS, build absolute/relative paths, check if paths are absolute/relative, and test ancestor/descendant relationships. Composer install.
public/uploads/ vs. public\uploads\).Adopt if:
str_replace(DIRECTORY_SEPARATOR, '/', $path)) with a maintainable, tested solution.realpath(), pathinfo()) or needs a simpler API.Look elsewhere if:
str_contains(), pathinfo(), or SplFileInfo) for modern path handling.symfony/finder or league/flysystem).spatie/path or Laravel’s built-in Filesystem).For Executives: "This package standardizes file path handling across our Laravel applications, eliminating platform-specific bugs (e.g., Windows/Linux path mismatches) that waste dev time. It’s a lightweight, MIT-licensed solution that replaces inconsistent DIY logic with a single, tested helper. Low risk, high reward for maintainability and cross-platform reliability."
For Engineers:
"Path Helper simplifies path manipulation with methods like normalize(), toUnix(), and isAbsolute(), replacing ad-hoc string operations. It’s a drop-in replacement for manual path logic, works with PHP 5.4+, and integrates seamlessly with Laravel’s filesystem. Tradeoff: Minimal maintenance (last updated 2022), but the API is simple and risk-free. Alternatives like Symfony’s Finder are overkill for basic path needs."
For Developers:
*"No more debugging file_put_contents() failures on Windows. This package handles:
C:\Users\file.txt → /Users/file.txt (or vice versa) with Path::normalize().Path::join('/var', 'log') → /var/log).composer require jackiedo/path-helper and replace your str_replace() hacks with reliable methods.Example Win:
Before:
$path = str_replace('\\', '/', $userUpload); // Fragile, OS-dependent.* *After*:$path = Path::normalize($userUpload); // Consistent, tested, and cross-platform."
Call to Action:
"Let’s adopt this for our next feature sprint to future-proof file operations. It’s a 5-minute composer require with long-term payoffs."
How can I help you explore Laravel packages today?