code-distortion/options
A Laravel package for managing application options in one place. Define settings once, set defaults, validate and cast values, then retrieve them consistently across your app. Lightweight and easy to integrate.
Install the package via Composer and publish any configuration if provided. Laravel’s package auto-discovery registers the service provider, so you can immediately resolve the package’s main class, facade, or trait. Start by reviewing the package’s README and config file to identify the primary API—typically a method that accepts an options array.
A simple first use case is passing a configuration array to a builder, component, or service. As of 0.6.1, you can safely include null values in that array; they are ignored instead of throwing an exception. This means you can pass dynamic options without pre-filtering:
use Vendor\Package\Facades\Package;
Package::make([
'title' => 'Welcome',
'subtitle' => $subtitle, // may be null
'color' => $color, // may be null
]);
null for optional values; the package skips them. This simplifies conditional logic and removes the need for array_filter.nullable rules for options that may be null.null options and asserts no exception is thrown. This locks in the new behaviour and documents the contract.null does not set a default value; it simply omits the option. Use the null coalescing operator (??) if you need a fallback.null. The package silently ignores it, so inspect the options array before handing it over.0.x release; pin to ^0.6 and review changelogs for potential breaking changes in minor releases.How can I help you explore Laravel packages today?