- How do I install mattketmo/camel in a Laravel project?
- Run `composer require mattketmo/camel` in your project directory. The package has zero dependencies and integrates instantly with Laravel’s existing string helpers like Str::camel(). No additional configuration is required unless you want to register global helpers.
- Does this package support recursive transformations for nested arrays or objects?
- The package handles flat arrays and strings by default. For nested structures (e.g., arrays of objects), you’ll need to manually loop through elements or create a wrapper function. Check the README for examples of bulk transformations if your use case requires deep recursion.
- Will mattketmo/camel break existing Laravel Str::camel() or Str::snake() functionality?
- No, this package is additive. It extends Laravel’s built-in string helpers with additional case transformations (e.g., StudlyCase, kebab-case) and bulk operations. Your existing Str::camel() calls will continue working as before.
- Can I use this for API request/response normalization in Laravel?
- Absolutely. The package is ideal for normalizing request payloads (e.g., converting snake_case form inputs to camelCase for DTOs) or standardizing API responses. Pair it with Laravel’s Form Requests or API Resources for seamless integration.
- Does mattketmo/camel support custom exceptions for specific keys (e.g., skip HTTPStatusCode)?
- Out of the box, the package applies transformations globally. To exclude certain keys, you’ll need to pre-filter your data or wrap the transformations in conditional logic. The package doesn’t include built-in whitelists/blacklists.
- How does this compare to Laravel’s built-in Str::camel() and Str::snake()?
- Laravel’s Str helpers are great for basic transformations, but mattketmo/camel adds support for StudlyCase, kebab-case, and bulk operations (e.g., converting entire arrays at once). It’s a lightweight alternative if you need more case formats or recursive handling.
- Is this package safe for production use? Any performance concerns?
- Yes, it’s production-ready with minimal overhead. The package is pure PHP, has no external dependencies, and transformations are optimized for speed. Use it in middleware, service providers, or model accessors without worrying about performance bottlenecks.
- Can I integrate mattketmo/camel into Laravel Excel for CSV/Excel case normalization?
- Yes, the package works alongside Laravel Excel. Use it to normalize column names or cell data before exporting/importing. For example, transform snake_case database columns to camelCase in your Excel mappings for consistency.
- How do I handle non-English words (e.g., über → uber) with this package?
- The package follows standard ASCII rules by default. For non-English words, you’ll need to pre-process strings (e.g., replace special characters) or extend the package with custom logic. There’s no built-in i18n support, but the core transformations are locale-agnostic.
- What Laravel versions does mattketmo/camel support, and is it actively maintained?
- The package is framework-agnostic but tested with Laravel 8+. Since it’s a tiny, dependency-free library, it’s unlikely to introduce version conflicts. Check the GitHub repo for maintenance status, but the MIT license and simple codebase suggest low-risk adoption.