cartalyst/support
Common support utilities for Cartalyst PHP/Laravel packages: helpers, contracts, traits, service providers, and base classes that streamline package development and shared functionality across components.
Start by installing via Composer: composer require cartalyst/support. This package is intentionally light and non-intrusive—no service provider registration needed. Jump straight into using its traits (e.g., HasAttributes, HasArrayAccess, Str) and helper functions (e.g., array_get, array_set, camel_case, snake_case) in any PHP class or global scope. A common first use case is enhancing plain PHP objects with HasAttributes to get convenient magic __get()/__set() and getAttributes() methods—ideal for DTOs or lightweight domain objects.
HasAttributes trait to value objects for safe, encapsulated property access and modification without boilerplate getters/setters.array_get()/array_set() with dot notation (e.g., array_get($data, 'user.profile.name')) for deeply nested array operations in config-heavy or API payload workflows.str_before(), str_after(), slugify(), or class_basename() directly—no Facades required.HasArrayAccess to make classes seamlessly integrate with Laravel’s ToArray/ToJson ecosystem—even outside Laravel projects.HasAttributes + HasArrayAccess + HasClassMethods for maximal flexibility in models or service classes.use function Cartalyst\Support\array_get; at the top of the file or call via fully qualified name.HasAttributes defines __get/__set—ensure your class doesn’t already rely on magic methods or use @method annotations to avoid IDE confusion.array_has() or null-coalescing checks when processing untrusted input.Str class is fully extendable—override or extend it via your own helper layer if custom string operations are needed (check Str::extend() in docs).How can I help you explore Laravel packages today?