ralphjsmit/laravel-helpers
Handy helpers for Laravel apps, including a Factory base class with resolveRelationship() for complex factory relations and a simple pipe implementation for passing data through sequential classes without closures. Great for cleaner factories and predictable pipelines.
Install via Composer: composer require ralphjsmit/laravel-helpers. No service provider or config publishing is required—helpers are auto-loaded via the package’s helpers.php file (PSR-4 autoloading in src/Helpers). The first use case is typically replacing verbose conditional checks with helpers like present() (returns formatted value if not null) or blank_or() (returns fallback for null/blank values), e.g. present($user->email) ?? 'No email'.
present(), number(), currency(), or truncate() directly in Blade or controllers to avoid @if/else chains and keep templates concise.blank_or($value, 'default') or filled_or($value, 'fallback').array_get_path($array, 'user.profile.name') for nested access or array_only_keys($array, ['name', 'email']) for filtering without array_filter boilerplate.unique_without() (for validation rules excluding current model) directly in request validation.starts_with($str, $prefix) instead of Str::startsWith() for brevity in internal code.”str_replace_first). This package extends Laravel helpers but doesn’t override them.blank() considers 0, '0', '', and [] as blank, while empty() does not. Always check the docblock or tests if behavior is ambiguous.src/Helpers/ for signature compatibility (e.g., typed returns using |null/|false).app/helpers.php, but do not rely on this package for custom logic—reserve it for standardized small utilities only.dd_safe() or dump_safe() to avoid issues with circular references or objects that can’t be serialized.How can I help you explore Laravel packages today?