dragon-code/support
Dragon Code Support is a lightweight helper toolkit for PHP/Laravel projects, providing facades, utilities, and common support classes. Designed to be extended with your own methods, with a clear structure for adding features and tests.
DragonCode\Support\Facades\*), aligning with Laravel’s native architecture (e.g., Arr, Str, File). This ensures seamless integration with existing Laravel applications, reducing cognitive load for developers familiar with Laravel’s helper ecosystem.Arr, Str, File, Digit, Instance) map cleanly to Laravel’s built-in helpers (e.g., collect(), Str::of()), enabling gradual adoption without disrupting existing patterns.Arr::of()->toInstance() or Arr::count() support Laravel’s fluent syntax, improving readability and maintainability in complex data transformations.Arr::customMerge()) without forking, reducing vendor lock-in.symfony/polyfill-php81 in v6.17.1) reduce bloat and conflict risk with other packages.Arr::flattenKeys() with mixed values) validate edge-case reliability, critical for production-grade utility layers.config/app.php and document when to use facades vs. direct classes.Arr::count()) overlap with Laravel’s native collect()->count(). Risk: Ambiguity in IDE autocompletion. Mitigation: Prefix methods (e.g., Arr::arrayCount()) or deprecate conflicting methods in favor of Laravel’s built-ins.Facade Strategy:
Arr → DragonCode\Support\Facades\Arr) or opt-in per module to avoid pollution?Arr::count() vs. collect()->count())?Adoption Scope:
ArrayHelper/StringUtils usage to the new facades?Testing and Validation:
Extensibility:
Deprecation Plan:
Str::*) work seamlessly in Blade templates.File::*, Directory::*) integrate with Laravel’s filesystem stack.Arr::of()->toInstance() can be mocked in PHPUnit).Arr, Str) are PHP-agnostic and can be used in non-Laravel PHP projects with minimal effort.Assessment Phase:
ArrayHelper, StringUtils) to identify overlapping functionality.Arr::flattenKeys() vs. custom implementations).Pilot Integration:
Arr and Str.ArrayHelper) with the package’s Arr facade.config/app.php:
'aliases' => [
'Arr' => DragonCode\Support\Facades\Arr::class,
'Str' => DragonCode\Support\Facades\Str::class,
],
use App\Helpers\ArrayHelper; to use Arr;.Gradual Rollout:
Arr::count(), Str::trim()).Arr::flattenKeys(), File::move()), ensuring data integrity during transitions.Filesystem/Heavy Operations:
File and Directory facades for asset management, backups, or uploads, leveraging methods like:
File::load($path, $validate = true) (with built-in validation).Directory::copy($source, $destination) for deployment pipelines.composer why-not to check for conflicts.Core Utilities First:
Arr, Str, and Instance facades for data transformations and type handling.collect($array)->pluck('id') with Arr::pluck($array, 'id').Filesystem Later:
File and Directory facades after core utilities to avoid blocking deployments on filesystem changes.Testing Infrastructure:
Arr::flattenKeys() with edge cases (mixed arrays, nested objects).Documentation:
How can I help you explore Laravel packages today?