{"id":20126054,"url":"https://github.com/inteve/types","last_synced_at":"2025-03-02T21:14:29.690Z","repository":{"id":56992749,"uuid":"132006749","full_name":"inteve/types","owner":"inteve","description":"Value objects and helpers for PHP.","archived":false,"fork":false,"pushed_at":"2023-07-05T10:11:05.000Z","size":69,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-13T09:08:01.326Z","etag":null,"topics":["datatypes","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inteve.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"license.md","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},"funding":{"custom":"https://www.janpecha.cz/donate/"}},"created_at":"2018-05-03T14:25:52.000Z","updated_at":"2025-01-11T11:54:34.000Z","dependencies_parsed_at":"2025-01-13T16:46:53.351Z","dependency_job_id":null,"html_url":"https://github.com/inteve/types","commit_stats":{"total_commits":36,"total_committers":1,"mean_commits":36.0,"dds":0.0,"last_synced_commit":"fe0dbcdd8d8011aaad7f070461d4aafb8fe4ed48"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inteve%2Ftypes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inteve%2Ftypes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inteve%2Ftypes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inteve%2Ftypes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inteve","download_url":"https://codeload.github.com/inteve/types/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241570919,"owners_count":19984002,"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":["datatypes","php"],"created_at":"2024-11-13T20:13:04.057Z","updated_at":"2025-03-02T21:14:29.663Z","avatar_url":"https://github.com/inteve.png","language":"PHP","funding_links":["https://www.janpecha.cz/donate/"],"categories":[],"sub_categories":[],"readme":"# Inteve\\Types\n\n[![Build Status](https://github.com/inteve/types/workflows/Build/badge.svg)](https://github.com/inteve/types/actions)\n[![Downloads this Month](https://img.shields.io/packagist/dm/inteve/types.svg)](https://packagist.org/packages/inteve/types)\n[![Latest Stable Version](https://poser.pugx.org/inteve/types/v/stable)](https://github.com/inteve/types/releases)\n[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/inteve/types/blob/master/license.md)\n\nValue objects and helpers for PHP.\n\n\u003ca href=\"https://www.janpecha.cz/donate/\"\u003e\u003cimg src=\"https://buymecoffee.intm.org/img/donate-banner.v1.svg\" alt=\"Donate\" height=\"100\"\u003e\u003c/a\u003e\n\n\n## Installation\n\n[Download a latest package](https://github.com/inteve/types/releases) or use [Composer](http://getcomposer.org/):\n\n```\ncomposer require inteve/types\n```\n\nInteve\\Types requires PHP 7.2.0 or later.\n\n\n## Usage\n\n* BinaryData\n* EmailAddress\n* [DatabaseDataType](#databasedatatype)\n* Decimal\n* [HexColor](#hexcolor)\n* [Html](#html)\n* IpAddress\n* [Md5Hash](#md5hash)\n* Password\n* [PhpType](#phptype)\n* [PhpParameterType](#phpparametertype)\n* UniqueId\n* [Url](#url)\n* UrlPath\n* UrlSlug\n\n\n### DatabaseDataType\n\n```php\nuse Inteve\\Types\\DatabaseDataType;\n\n$type = new DatabaseDataType('INT', [10], ['UNSIGNED']);\n$type-\u003egetType();\n$type-\u003egetParameters();\n$type-\u003egetOptions();\n$type-\u003ehasOption('UNSIGNED'); // returns TRUE\n$type-\u003egetOptionValue('UNSINGED'); // returns mixed|NULL\n```\n\n\n### HexColor\n\n```php\nuse Inteve\\Types\\HexColor;\n\n$color = new HexColor('0088FF');\n$color-\u003egetValue(); // returns '0088ff'\n$color-\u003egetCssValue(); // returns '#0088ff'\n\n// from CSS color\n$color = HexColor::fromCssColor('#0088ff');\n```\n\n### Html\n\n```php\nuse Inteve\\Types\\Html;\n\n$html = new Html('\u003cp\u003eLorem \u0026gt; ipsum\u003c/p\u003e');\n$html-\u003egetHtml();\n(string) $html; // alias for getHtml()\n\n$html-\u003egetPlainText(); // returns text without HTML tags \u0026 entities ('Lorem \u003e ipsum')\n```\n\nIt implements `Nette\\Utils\\IHtmlString` so can be used directly in Latte template (`{$html}`) without `|noescape` modifier.\n\n\n### Md5Hash\n\n```php\nuse Inteve\\Types\\Md5Hash;\n\n$md5 = new Md5Hash($hash);\n$md5-\u003egetHash(); // returns $hash\n\n// from string\n$md5 = Md5Hash::from('Lorem ipsum dolor.');\n\n// from file\n$md5 = Md5Hash::fromFile('/path/to/file');\n```\n\n\n### PhpType\n\n```php\nuse Inteve\\Types\\PhpType;\n\n$type = new PhpType('bool');\n$type-\u003egetType();\n(string) $type; // alias for getType()\n$type-\u003eisBasicType(); // returns TRUE\n\n$type = new PhpType(PhpType::class);\n$type-\u003eisBasicType(); // returns FALSE\n```\n\nYou can use static factories:\n\n```php\n$type = PhpType::arrayType();\n$type = PhpType::boolType();\n$type = PhpType::floatType();\n$type = PhpType::intType();\n$type = PhpType::stringType();\n$type = PhpType::classType(PhpType::class);\n\n$type = PhpType::fromParameterType(new PhpParameterType('string'));\n```\n\nIt implements `Inteve\\Types\\IPhpParameterType`.\n\n\n### PhpParameterType\n\n```php\nuse Inteve\\Types\\PhpParameterType;\n\n$type = new PhpParameterType('bool');\n$type-\u003egetType();\n(string) $type; // alias for getType()\n$type-\u003eisBasicType(); // returns TRUE\n\n$type = new PhpParameterType(PhpParameterType::class);\n$type-\u003eisBasicType(); // returns FALSE\n```\n\nYou can use static factories:\n\n```php\n$type = PhpParameterType::arrayType();\n$type = PhpParameterType::boolType();\n$type = PhpParameterType::floatType();\n$type = PhpParameterType::intType();\n$type = PhpParameterType::stringType();\n$type = PhpParameterType::callableType();\n$type = PhpParameterType::iterableType();\n$type = PhpParameterType::selfType();\n$type = PhpParameterType::objectType();\n$type = PhpParameterType::classType(PhpParameterType::class);\n\n$type = PhpParameterType::fromPhpType(new PhpType('string'));\n```\n\nIt implements `Inteve\\Types\\IPhpParameterType`.\n\n\n### Url\n\n```php\nuse Inteve\\Types\\Url;\n\n$url = new Url('https://example.com/page');\n$url-\u003egetUrl();\n(string) $url; // alias for getUrl()\n```\n\n\n------------------------------\n\nLicense: [New BSD License](license.md)\n\u003cbr\u003eAuthor: Jan Pecha, https://www.janpecha.cz/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finteve%2Ftypes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finteve%2Ftypes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finteve%2Ftypes/lists"}