Looking to hire Laravel developers? Try LaraJobs

laravel-config-types maintained by thuraaung2493

Description
A small wrapper types safe class for Laravel config.
Author
Last update
2023/11/09 10:45 (dev-main)
License
Links
Downloads
19

Comments
comments powered by Disqus

Laravel Config Types

It supports Laravel 9+ and PHP 8.2+

Installation

composer require thuraaung2493/laravel-config-types

Usage


// Facades
use Thuraaung\ConfigTypes\Facades\Config

  Config::string('app.name') // 'Laravel'

// Via Service Container

use Thuraaung\ConfigTypes\ConfigResolver;

class Example
{
  public function __construct(
    private readonly ConfigResolver $config,
  ) {}

  public function test(): string
  {
    return $this->config->string('app.name');
  }
}

$example = new Example();
$example->test() // 'Laravel'

Test

  composer test

License

This package is open-sourced software licensed under the MIT license