PHP code example of fyre / typeparser

1. Go to this page and download the library: Download fyre/typeparser 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');

/* Start to develop here. Best regards https://php-download.com/ */

    

fyre / typeparser example snippets


use Fyre\DB\TypeParser;

TypeParser::clear();

$typeClass = TypeParser::getType($type);

$typeMap = TypeParser::useMap();

TypeParser::mapType($type, $typeClass);

$parser = TypeParser::use($type);

$parsedValue = $parser->fromDatabase($value);

$parsedValue = $parser->parse($value);

$dbValue = $parser->toDatabase($value);

$parser = TypeParser::use('binary');

$parser = TypeParser::use('boolean');

$parser = TypeParser::use('date');

$format = $parser->getLocaleFormat();

$parser->setLocaleFormat($format);

$parser = TypeParser::use('datetime');

$format = $parser->getLocaleFormat();

$timeZone = $parser->getServerTimeZone();

$timeZone = $parser->getUserTimeZone();

$parser->setLocaleFormat($format);

$parser->setServerTimeZone($timeZone);

$parser->setUserTimeZone($timeZone);

$parser = TypeParser::use('datetime-fractional');

$format = $parser->getLocaleFormat();

$timeZone = $parser->getServerTimeZone();

$timeZone = $parser->getUserTimeZone();

$parser->setLocaleFormat($format);

$parser->setServerTimeZone($timeZone);

$parser->setUserTimeZone($timeZone);

$parser = TypeParser::use('datetime-timezone');

$format = $parser->getLocaleFormat();

$timeZone = $parser->getServerTimeZone();

$timeZone = $parser->getUserTimeZone();

$parser->setLocaleFormat($format);

$parser->setServerTimeZone($timeZone);

$parser->setUserTimeZone($timeZone);

$parser = TypeParser::use('decimal');

$parser = TypeParser::use('enum');

$parser = TypeParser::use('float');

$parser = TypeParser::use('integer');

$parser = TypeParser::use('json');

$parser->setEncodingFlags($flags);

$parser = TypeParser::use('set');

$parser = TypeParser::use('string');

$parser = TypeParser::use('text');

$parser = TypeParser::use('time');

$format = $parser->getLocaleFormat();

$parser->setLocaleFormat($format);