open-southeners/extended-php
Extended PHP helpers for modern apps: adds convenient functions, utilities, and small enhancements that complement core PHP to reduce boilerplate and speed up everyday development. Lightweight, easy to drop into existing projects.
Installation
composer require open-southeners/extended-php
First Use Case
Str::camel_case('hello_world') for instant conversion.Arr::dot('array', 'key') for nested array access.collect($array)->toJsonApi() for API responses.Where to Look First
src/Extended namespace for core utilities.Extended::helper() for dynamic method calls (e.g., Extended::helper('str', 'snake_case')).tests/ for real-world usage patterns.String Utilities
Str::of($str)->slug() with Extended::str()->slug($str) for chaining.$title = Extended::str()
->title_case('hello_world')
->limit(50)
->toString();
Array/Collection Extensions
Arr::wrap($value) or collect($data)->groupBy('category') for Laravel integration.$grouped = collect($users)->groupBy('role', Extended::arr());
DateTime Helpers
Extended::date()->format('Y-m-d', $timestamp).$formatted = Extended::date()->diffForHumans($createdAt);
API Response Shortcuts
Extended::response()->jsonApi($data, $meta).return Extended::response()->jsonApi($posts, ['page' => 1]);
@php use Extended\Str; @endphp to access helpers directly in views.config/app.php for global access:
'aliases' => [
'Extended' => Extended\Facades\Extended::class,
],
Extended facade in tests:
$this->partialMock(Extended::class, ['helper']);
Namespace Collisions
Extended\Str may conflict with Laravel’s Illuminate\Support\Str.Extended::str()->slug()) or alias the facade.Performance Overhead
Extended::str()->...->...) may impact performance.Extended::str()->slug($str)).Undocumented Methods
Extended::misc()->randomize()) lack docs.tests/ or use php artisan tinker to explore:
Extended::helper('misc', 'randomize', [1, 10]);
Extended::setDebug(true); // Logs helper calls to Laravel logs.
dd(Extended::availableHelpers()); // Lists all registered utilities.
Custom Helpers
Extended::addHelper('custom', function ($input) {
return strtoupper($input);
});
Extended::helper('custom', 'hello').Override Defaults
Extended\Str) by publishing config:
php artisan vendor:publish --provider="OpenSoutheners\Extended\ExtendedServiceProvider"
config/extended.php to override defaults (e.g., slug_separator).Facade Customization
AppServiceProvider:
Extended::swap(new CustomExtendedHelper());
How can I help you explore Laravel packages today?