{"id":21467431,"url":"https://github.com/elusivecodes/fyretypeparser","last_synced_at":"2026-03-13T10:33:15.364Z","repository":{"id":62508483,"uuid":"450082337","full_name":"elusivecodes/FyreTypeParser","owner":"elusivecodes","description":"FyreTypeParser is a free, open-source database type parser library for PHP.","archived":false,"fork":false,"pushed_at":"2024-10-28T11:28:27.000Z","size":173,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-28T14:00:55.084Z","etag":null,"topics":["database","php","type-parser"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elusivecodes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-20T12:09:40.000Z","updated_at":"2024-10-28T11:26:30.000Z","dependencies_parsed_at":"2024-06-09T14:32:07.688Z","dependency_job_id":"61c91462-c06e-4575-b1ac-c1e3a80771d1","html_url":"https://github.com/elusivecodes/FyreTypeParser","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreTypeParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreTypeParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreTypeParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreTypeParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elusivecodes","download_url":"https://codeload.github.com/elusivecodes/FyreTypeParser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226017529,"owners_count":17560532,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","php","type-parser"],"created_at":"2024-11-23T08:18:06.537Z","updated_at":"2025-10-12T12:49:48.904Z","avatar_url":"https://github.com/elusivecodes.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FyreTypeParser\r\n\r\n**FyreTypeParser** is a free, open-source database type parser library for *PHP*.\r\n\r\n\r\n## Table Of Contents\r\n- [Installation](#installation)\r\n- [Basic Usage](#basic-usage)\r\n- [Methods](#methods)\r\n- [Types](#types)\r\n    - [Binary](#binary)\r\n    - [Boolean](#boolean)\r\n    - [DateTime](#datetime)\r\n    - [DateTime (Fractional)](#datetime-fractional)\r\n    - [DateTime (Time Zone)](#datetime-time-zone)\r\n    - [Decimal](#decimal)\r\n    - [Enum](#enum)\r\n    - [Float](#float)\r\n    - [Integer](#integer)\r\n    - [Json](#json)\r\n    - [Set](#set)\r\n    - [String](#string)\r\n    - [Text](#text)\r\n    - [Time](#time)\r\n\r\n\r\n\r\n## Installation\r\n\r\n**Using Composer**\r\n\r\n```\r\ncomposer require fyre/typeparser\r\n```\r\n\r\nIn PHP:\r\n\r\n```php\r\nuse Fyre\\DB\\TypeParser;\r\n```\r\n\r\n\r\n## Basic Usage\r\n\r\n- `$container` is a [*Container*](https://github.com/elusivecodes/FyreContainer).\r\n\r\n```php\r\n$typeParser = new TypeParser($container);\r\n```\r\n\r\n**Autoloading**\r\n\r\nIt is recommended to bind the *TypeParser* to the [*Container*](https://github.com/elusivecodes/FyreContainer) as a singleton.\r\n\r\n```php\r\n$container-\u003esingleton(TypeParser::class);\r\n```\r\n\r\nAny dependencies will be injected automatically when loading from the [*Container*](https://github.com/elusivecodes/FyreContainer).\r\n\r\n```php\r\n$typeParser = $container-\u003euse(TypeParser::class);\r\n```\r\n\r\n\r\n## Methods\r\n\r\n**Clear**\r\n\r\nClear all loaded types.\r\n\r\n```php\r\n$typeParser-\u003eclear();\r\n```\r\n\r\n**Get Type**\r\n\r\nGet the mapped [*Type*](#types) class for a value type.\r\n\r\n- `$type` is a string representing the value type.\r\n\r\n```php\r\n$typeClass = $typeParser-\u003egetType($type);\r\n```\r\n\r\n**Get Type Map**\r\n\r\nGet the type class map.\r\n\r\n```php\r\n$typeMap = $typeParser-\u003egetTypeMap();\r\n```\r\n\r\n**Map**\r\n\r\nMap a value type to a class.\r\n\r\n- `$type` is a string representing the value type.\r\n- `$typeClass` is a string representing the class name.\r\n\r\n```php\r\n$typeParser-\u003emap($type, $typeClass);\r\n```\r\n\r\n**Use**\r\n\r\nLoad a shared [*Type*](#types) instance for a value type.\r\n\r\n- `$type` is a string representing the value type.\r\n\r\n```php\r\n$parser = $typeParser-\u003euse($type);\r\n```\r\n\r\nCustom [*Type*](#types) dependencies will be resolved automatically from the [*Container*](https://github.com/elusivecodes/FyreContainer).\r\n\r\n\r\n## Types\r\n\r\nYou can load a specific type parser by specifying the `$type` argument of the `use` method above.\r\n\r\nCustom type parsers can be created by extending `\\Fyre\\DB\\Types\\Type`, ensuring all below methods are implemented.\r\n\r\n**From Database**\r\n\r\nParse a database value to PHP value.\r\n\r\n- `$value` is the value to parse.\r\n\r\n```php\r\n$parsedValue = $parser-\u003efromDatabase($value);\r\n```\r\n\r\n**Parse**\r\n\r\nParse a user value to PHP value.\r\n\r\n- `$value` is the value to parse.\r\n\r\n```php\r\n$parsedValue = $parser-\u003eparse($value);\r\n```\r\n\r\n**To Database**\r\n\r\nParse a PHP value to database value.\r\n\r\n- `$value` is the value to parse.\r\n\r\n```php\r\n$dbValue = $parser-\u003etoDatabase($value);\r\n```\r\n\r\n### Binary\r\n\r\n```php\r\n$parser = $typeParser-\u003euse('binary');\r\n```\r\n\r\n### Boolean\r\n\r\n```php\r\n$parser = $typeParser-\u003euse('boolean');\r\n// or $typeParser-\u003euse('bool');\r\n```\r\n\r\n### Date\r\n\r\n```php\r\n$parser = $typeParser-\u003euse('date');\r\n```\r\n\r\n**Get Locale Format**\r\n\r\nGet the locale format.\r\n\r\n```php\r\n$format = $parser-\u003egetLocaleFormat();\r\n```\r\n\r\n**Set Locale Format**\r\n\r\nSet the locale format.\r\n\r\n- `$format` is a string representing the locale format.\r\n\r\n```php\r\n$parser-\u003esetLocaleFormat($format);\r\n```\r\n\r\n### DateTime\r\n\r\n```php\r\n$parser = $typeParser-\u003euse('datetime');\r\n```\r\n\r\n**Get Locale Format**\r\n\r\nGet the locale format.\r\n\r\n```php\r\n$format = $parser-\u003egetLocaleFormat();\r\n```\r\n\r\n**Get Server Time Zone**\r\n\r\nGet the server time zone.\r\n\r\n```php\r\n$timeZone = $parser-\u003egetServerTimeZone();\r\n```\r\n\r\n**Get User Time Zone**\r\n\r\nGet the user time zone.\r\n\r\n```php\r\n$timeZone = $parser-\u003egetUserTimeZone();\r\n```\r\n\r\n**Set Locale Format**\r\n\r\nSet the locale format.\r\n\r\n- `$format` is a string representing the locale format, or a *Closure* that returns the locale format.\r\n\r\n```php\r\n$parser-\u003esetLocaleFormat($format);\r\n```\r\n\r\n**Set Server Time Zone**\r\n\r\nGet the server time zone.\r\n\r\n- `$timeZone` is a string representing the time zone name.\r\n\r\n```php\r\n$parser-\u003esetServerTimeZone($timeZone);\r\n```\r\n\r\n**Set User Time Zone**\r\n\r\nGet the user time zone.\r\n\r\n- `$timeZone` is a string representing the time zone name, or a *Closure* that returns the time zone name.\r\n\r\n```php\r\n$parser-\u003esetUserTimeZone($timeZone);\r\n```\r\n\r\n### DateTime (Fractional)\r\n\r\n```php\r\n$parser = $typeParser-\u003euse('datetime-fractional');\r\n```\r\n\r\n**Get Locale Format**\r\n\r\nGet the locale format.\r\n\r\n```php\r\n$format = $parser-\u003egetLocaleFormat();\r\n```\r\n\r\n**Get Server Time Zone**\r\n\r\nGet the server time zone.\r\n\r\n```php\r\n$timeZone = $parser-\u003egetServerTimeZone();\r\n```\r\n\r\n**Get User Time Zone**\r\n\r\nGet the user time zone.\r\n\r\n```php\r\n$timeZone = $parser-\u003egetUserTimeZone();\r\n```\r\n\r\n**Set Locale Format**\r\n\r\nSet the locale format.\r\n\r\n- `$format` is a string representing the locale format.\r\n\r\n```php\r\n$parser-\u003esetLocaleFormat($format);\r\n```\r\n\r\n**Set Server Time Zone**\r\n\r\nGet the server time zone.\r\n\r\n- `$timeZone` is a string representing the time zone name.\r\n\r\n```php\r\n$parser-\u003esetServerTimeZone($timeZone);\r\n```\r\n\r\n**Set User Time Zone**\r\n\r\nGet the user time zone.\r\n\r\n- `$timeZone` is a string representing the time zone name.\r\n\r\n```php\r\n$parser-\u003esetUserTimeZone($timeZone);\r\n```\r\n\r\n### DateTime (Time Zone)\r\n\r\n```php\r\n$parser = $typeParser-\u003euse('datetime-timezone');\r\n```\r\n\r\n**Get Locale Format**\r\n\r\nGet the locale format.\r\n\r\n```php\r\n$format = $parser-\u003egetLocaleFormat();\r\n```\r\n\r\n**Get Server Time Zone**\r\n\r\nGet the server time zone.\r\n\r\n```php\r\n$timeZone = $parser-\u003egetServerTimeZone();\r\n```\r\n\r\n**Get User Time Zone**\r\n\r\nGet the user time zone.\r\n\r\n```php\r\n$timeZone = $parser-\u003egetUserTimeZone();\r\n```\r\n\r\n**Set Locale Format**\r\n\r\nSet the locale format.\r\n\r\n- `$format` is a string representing the locale format.\r\n\r\n```php\r\n$parser-\u003esetLocaleFormat($format);\r\n```\r\n\r\n**Set Server Time Zone**\r\n\r\nGet the server time zone.\r\n\r\n- `$timeZone` is a string representing the time zone name.\r\n\r\n```php\r\n$parser-\u003esetServerTimeZone($timeZone);\r\n```\r\n\r\n**Set User Time Zone**\r\n\r\nGet the user time zone.\r\n\r\n- `$timeZone` is a string representing the time zone name.\r\n\r\n```php\r\n$parser-\u003esetUserTimeZone($timeZone);\r\n```\r\n\r\n### Decimal\r\n\r\n```php\r\n$parser = $typeParser-\u003euse('decimal');\r\n```\r\n\r\n### Enum\r\n\r\n```php\r\n$parser = $typeParser-\u003euse('enum');\r\n```\r\n\r\n### Float\r\n\r\n```php\r\n$parser = $typeParser-\u003euse('float');\r\n```\r\n\r\n### Integer\r\n\r\n```php\r\n$parser = $typeParser-\u003euse('integer');\r\n// or $typeParser-\u003euse('int');\r\n```\r\n\r\n### Json\r\n\r\n```php\r\n$parser = $typeParser-\u003euse('json');\r\n```\r\n\r\n**Set Encoding Flags**\r\n\r\nSet the encoding flags.\r\n\r\n- `$flags` is a number representing the encoding flags.\r\n\r\n```php\r\n$parser-\u003esetEncodingFlags($flags);\r\n```\r\n\r\n### Set\r\n\r\n```php\r\n$parser = $typeParser-\u003euse('set');\r\n```\r\n\r\n### String\r\n\r\n```php\r\n$parser = $typeParser-\u003euse('string');\r\n```\r\n\r\n### Text\r\n\r\n```php\r\n$parser = $typeParser-\u003euse('text');\r\n```\r\n\r\n### Time\r\n\r\n```php\r\n$parser = $typeParser-\u003euse('time');\r\n```\r\n\r\n**Get Locale Format**\r\n\r\nGet the locale format.\r\n\r\n```php\r\n$format = $parser-\u003egetLocaleFormat();\r\n```\r\n\r\n**Set Locale Format**\r\n\r\nSet the locale format.\r\n\r\n- `$format` is a string representing the locale format.\r\n\r\n```php\r\n$parser-\u003esetLocaleFormat($format);\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felusivecodes%2Ffyretypeparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felusivecodes%2Ffyretypeparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felusivecodes%2Ffyretypeparser/lists"}