Download the PHP package abather/custom-data-helpers without Composer
On this page you can find all versions of the php package abather/custom-data-helpers. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download abather/custom-data-helpers
More information about abather/custom-data-helpers
Files in abather/custom-data-helpers
Package custom-data-helpers
Short Description extend data helpers to include custom seperators.
License MIT
Homepage https://github.com/abather/custom-data-helpers
Informations about the package custom-data-helpers
Custom Data Helpers for Laravel
Description
This Laravel package extends the default data helper functions (data_get, data_set, data_forget, data_has) to support custom separators instead of the hardcoded dot (.) notation.
Laravel's built-in data helpers are fantastic, but they use a fixed dot separator which can cause issues when your data keys contain actual dots. This package solves that problem by allowing you to specify any separator you want.
Installation
You can install the package via composer:
That's it! The package will auto-register itself in Laravel and the helper functions will be available globally.
Usage
The package provides three ways to use custom data helpers:
1. Using the DataHelper Class (Recommended)
2. Using Global Helper Functions
DataHelper::get() - Retrieve Values
Retrieve a value from a nested array or object using a custom separator.
DataHelper::set() - Set Values
Set a value within a nested array or object using a custom separator.
DataHelper::has() - Check if Key Exists
Check if a key exists in an array or object using a custom separator.
DataHelper::forget() - Remove Values
Remove a value from a nested array or object using a custom separator.
Real-World Use Cases
1. Working with Keys Containing Dots
2. URL-Style Paths
3. Object Notation Style
Backward Compatibility
The DataHelper class and helper functions use dot notation by default, making them compatible with Laravel's conventions. The package uses underscore-prefixed global functions (_data_*) to avoid conflicts with Laravel's built-in helpers.
Features
- ✅ Custom separator support for all data helpers
- ✅ Wildcard operations (
*) - ✅ Placeholder support (
{first},{last}) - ✅ Works with arrays and objects
- ✅ Laravel Collections support
- ✅ 100% backward compatible with Laravel's default helpers
- ✅ No configuration needed
- ✅ Auto-discovery enabled
- ✅ Fully tested
Requirements
- PHP 8.4 or higher
- Laravel 11.x or 12.x
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Abather
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of custom-data-helpers with dependencies
laravel/framework Version ^11.0|^12.0
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0||^12.0