grasmash/expander
Expander is a Laravel package for managing feature rollouts and gating functionality. It helps you define “expansions” that can be enabled per environment, user, or percentage, making it easy to ship safely, run experiments, and toggle features without redeploys.
{"user": {"posts": "${user.id}"}} into fully hydrated objects). Reduces manual mapping logic in controllers/transformers.${env.DB_HOST} in config/database.php.with() or load() for Eloquent.?expand=comments,author into single queries (e.g., post.comments → ${post.id}/comments).${user.name} placeholders).${factories.user} → UserFactory::new()).expand parameters, config files with cross-references).if ($payload['user']) { $payload['user'] = User::find($payload['user']['id']); }).${env.APP_DEBUG} in logs or configs).Executives:
"This package cuts 20–40% of the boilerplate in our API layer by automating data expansion—think of it as a ‘templating engine for PHP arrays.’ It’s MIT-licensed, actively maintained (PHP 8.4 support), and future-proofs our configs/APIs for dynamic features like multi-tenancy or A/B testing. For example, instead of manually resolving
user.postsin every endpoint, we define it once and reuse it everywhere. This reduces tech debt and accelerates feature delivery without hiring more engineers."
Engineering (Devs/Architects):
*"Imagine Laravel’s
with()on steroids: recursive, configurable, and extensible. You can:
- Expand
${user.posts}into a fullPostcollection with a single line of code.- Resolve environment variables (
${env.API_KEY}) in configs or payloads.- Chain expanders for complex workflows (e.g.,
user → posts → comments). The package handles edge cases like circular references, null safety, and custom stringification (e.g., arrays → CSV). Zero dependency bloat—just Composer install and go. Perfect for APIs, CLI tools, or even testing data factories."*
QA/DevOps:
"This standardizes how we handle dynamic data, reducing bugs from inconsistent transformations. For example, if
config/services.phpuses${env.DB_PASSWORD}, we no longer risk hardcoded secrets in PRs. The logger integration also helps debug expansion failures in staging/prod."
How can I help you explore Laravel packages today?