Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Composer Configurable Plugin Laravel Package

cweagans/composer-configurable-plugin

Composer plugin that makes package configuration flexible by reading and merging settings from composer.json (extra) and other sources. Useful for teams needing configurable behavior across environments without hardcoding values in the plugin itself.

View on GitHub
Deep Wiki
Context7

Getting Started

Start by installing the package via Composer: composer require cweagans/composer-configurable-plugin. Once installed, register the plugin in your composer.json by adding it to the extra.plugins section under the type key composer-configurable-plugin. The plugin looks for configuration in a composer.configurable.php file at the project root (or defined via the configurable-config extra key). Your first use case will likely involve defining a configuration schema that other Composer plugins or custom scripts can consume—e.g., enabling plugin-specific settings like cache paths, API endpoints, or feature flags without hard-coding them.

Implementation Patterns

Use composer.configurable.php to define a configuration schema as an associative array with keys for required, optional, and defaults. Return this schema from the file, and it will be merged with environment variables, config overrides (config section in composer.json), and runtime arguments. Plugins or scripts can then read the resolved configuration via Composer\Config::getConfigSource()->getAllConfig() (look for the extra.configurable namespace). Common patterns include defining environment-specific settings (e.g., LOCAL_CACHE_DIRconfig.local.php) or exposing plugin behavior toggles (e.g., enable_cdn, strict_validation) without modifying source code. Leverage the Composer\EventDispatcher\Event objects to inject configuration values into custom script logic.

Gotchas and Tips

Configuration values are not auto-cast—ensure explicit validation and type coercion in your consumer code (e.g., cast true/false strings to booleans using filter_var($value, FILTER_VALIDATE_BOOLEAN)). The package doesn’t validate schema at install time—misconfigured values may only surface as runtime errors. If your plugin depends on this config system, document the expected keys and types clearly. Use the configurable-config extra key to override the default config file path for monorepos. Debug config resolution by running composer show -p and inspecting the extra section, or add a pre-update script to var_dump(Composer\Factory::getComposer()->getConfig()->getAllConfig()) to trace effective values. Note: This package itself doesn’t provide any CLI; it’s purely a configuration infrastructure layer—consumers must implement the actual plugin behavior.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai