hotmeteor / titles

A set of ready-made title helper methods for use in your Laravel application.
2 stars 1 forks source link

Configuration #3

Closed shaedrich closed 1 month ago

shaedrich commented 8 months ago

There are a couple options and combination of how fine-grained configuration can be designed to be:

Levels

Defaults/presets

?

Config

As for the rules, this could even made entirely configurable by adding a new configuration file (config/writing_style.php, similar to larastan) with rules like either

return [
    'rules' => [
        \Apa\TitleCase::class,
        \\ \Apa\SentenceCase::class,
        \\ \ChicagoStyle\SerialComma::class,
    ],
];

or

return [
    'title_case' => Env::get('WRITING_STYLE_TITLE_CASE', WritingStyle::APA->value), // 'apa'
    'serial_comma' => Env::get('WRITING_STYLE_SERIAL_COMMA', false),
];

Method-level overwrites

Optionally, overwrites could be passed to Str::style($text, [ 'serial_comma' => true ]) (or WritingStyle::apply())

Localization (@hotmeteor)

see lang/

Service provider (@hotmeteor)

new StyleFactory(
    style: config('writer.style'),
    language: config('writer.lang')   
)

Axes

shaedrich commented 7 months ago

For all possible config options see https://github.com/hotmeteor/titles/issues/1#issuecomment-1888188589

shaedrich commented 1 month ago

Superseded by shaedrich/titles#5