PHP code example of smpita / configas
1. Go to this page and download the library: Download smpita/configas library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once ('vendor/autoload.php' );
smpita / configas example snippets
use Smpita \ConfigAs \ConfigAs ;
$typed = ConfigAs::int('config.key' );
use Smpita \ConfigAs \ConfigAs ;
$typed = ConfigAs::int('config.key' , 123 );
use Smpita \ConfigAs \ConfigAs ;
$typed = ConfigAs::class(Target::class, 'config.key' );
use Smpita \ConfigAs \ConfigAs ;
$typed = ConfigAs::class(Target::class, 'config.key' , new Target('default' ));
use Smpita \ConfigAs \ConfigAs ;
ConfigAs::nullableString('config.key' ) === null ;
use Smpita \ConfigAs \ConfigAs ;
$typed = ConfigAs::freshString('config.key' );
use Smpita \ConfigAs \ConfigAs ;
ConfigAs::forgetFloat('config.key' );
use Smpita \ConfigAs \ConfigAs ;
ConfigAs::flushFloats();
use Smpita \ConfigAs \ConfigAs ;
ConfigAs::flush();
$typed = Smpita\ConfigAs::string('config.key' , null , new CustomStringResolver);
use function Smpita \ConfigAs \configAs ;
$configAs = configAs();
$string = $configAs->string('config.string.key' );
$array = $configAs->array('config.array.key' );
use function Smpita \ConfigAs \configString ;
$typed = configString('config.key' );