{"id":47603740,"url":"https://github.com/cniska/php-conversion","last_synced_at":"2026-04-04T03:00:46.138Z","repository":{"id":409076,"uuid":"13691428","full_name":"cniska/php-conversion","owner":"cniska","description":"Library for converting units and sizes in PHP","archived":false,"fork":false,"pushed_at":"2022-06-15T20:21:42.000Z","size":91,"stargazers_count":132,"open_issues_count":5,"forks_count":19,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-03-13T06:52:02.556Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cniska.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}},"created_at":"2013-10-18T22:46:17.000Z","updated_at":"2025-05-15T08:31:13.000Z","dependencies_parsed_at":"2022-08-16T10:25:08.354Z","dependency_job_id":null,"html_url":"https://github.com/cniska/php-conversion","commit_stats":null,"previous_names":["cniska/php-conversion"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/cniska/php-conversion","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cniska%2Fphp-conversion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cniska%2Fphp-conversion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cniska%2Fphp-conversion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cniska%2Fphp-conversion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cniska","download_url":"https://codeload.github.com/cniska/php-conversion/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cniska%2Fphp-conversion/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31385935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T01:22:39.193Z","status":"online","status_checked_at":"2026-04-04T02:00:07.569Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-04-01T19:00:25.359Z","updated_at":"2026-04-04T03:00:46.124Z","avatar_url":"https://github.com/cniska.png","language":"PHP","funding_links":[],"categories":["Table of Contents"],"sub_categories":["Numbers"],"readme":"php-conversion\n==============\n[![Build Status](https://travis-ci.org/crisu83/php-conversion.png?branch=master)](https://travis-ci.org/crisu83/php-conversion)\n\nLibrary for converting units and sizes in PHP.\n\n## Units supported\n\n * Acceleration\n * Angle\n * Area\n * Digital information\n * Electric current\n * Frequency\n * Fuel consumption\n * Length\n * Luminous Intensity\n * Mass\n * Power\n * Pressure\n * Speed\n * Temperature\n * Time\n * Velocity\n * Voltage\n * Volume\n\n## Sizes supported\n\n * Hat size\n * Child shoe size\n\n## Number base supported\n\n * Binary\n * Octal\n * Decimal\n * Hexadecimal\n\n## Usage\n\nExample usage:\n\n```php\nuse Crisu83\\Conversion\\Quantity\\DigitalInformation\\DigitalInformation;\nuse Crisu83\\Conversion\\Quantity\\Length\\Length;\nuse Crisu83\\Conversion\\NumberBase\\NumberBase;\nuse Crisu83\\Conversion\\Size\\HatSize\\HatSize;\nuse Crisu83\\Conversion\\Size\\ShoeSize\\ChildShoeSize;\n\nuse Crisu83\\Conversion\\Quantity\\Length\\Unit as LengthUnit;\nuse Crisu83\\Conversion\\Quantity\\DigitalInformation\\Unit as DIUnit;\nuse Crisu83\\Conversion\\Size\\HatSize\\System as HatSizeSystem;\nuse Crisu83\\Conversion\\Size\\ShoeSize\\System as ShoeSizeSystem;\n\nrequire(dirname(__DIR__) . '/vendor/autoload.php');\n\n$length = new Length(1, LengthUnit::METRE);\necho $length . '\u003cbr\u003e';\necho $length-\u003eadd(1, LengthUnit::FOOT) . '\u003cbr\u003e';\necho $length-\u003eadd(5)-\u003esub(2, LengthUnit::FOOT) . '\u003cbr\u003e';\necho $length-\u003eto(LengthUnit::YARD) . '\u003cbr\u003e';\n\necho '\u003cbr\u003e';\n\n$di = new DigitalInformation(1000, DIUnit::MEGABYTE);\necho $di . '\u003cbr\u003e';\necho $di-\u003eto(DIUnit::BIT)-\u003eout(2, '.', '') . '\u003cbr\u003e';\necho $di-\u003eto(DIUnit::GIGABIT) . '\u003cbr\u003e';\necho $di-\u003eto(DIUnit::TERABYTE)-\u003eout(10) . '\u003cbr\u003e';\n\necho '\u003cbr\u003e';\n\n$number = new NumberBase(\"0xff\", NumberBase::HEXADECIMAL);\necho $number . '\u003cbr\u003e';\necho $number-\u003eto(NumberBase::DECIMAL) . '\u003cbr\u003e';\necho $number-\u003eto(NumberBase::OCTAL) . '\u003cbr\u003e';\necho $number-\u003eto(NumberBase::BINARY) . '\u003cbr\u003e';\n\necho '\u003cbr\u003e';\n\n$hatSize = new HatSize(40, HatSizeSystem::CENTIMETRE);\necho $hatSize . '\u003cbr\u003e';\necho $hatSize-\u003eto(HatSizeSystem::AMERICAN) . '\u003cbr\u003e';\necho $hatSize-\u003eto(HatSizeSystem::BRITISH) . '\u003cbr\u003e';\necho $hatSize-\u003eto(HatSizeSystem::INCH) . '\u003cbr\u003e';\n\necho '\u003cbr\u003e';\n\n$shoeSize = new ChildShoeSize(20, ShoeSizeSystem::EUROPEAN);\necho $shoeSize . '\u003cbr\u003e';\necho $shoeSize-\u003eto(ShoeSizeSystem::AMERICAN) . '\u003cbr\u003e';\necho $shoeSize-\u003eto(ShoeSizeSystem::BRITISH) . '\u003cbr\u003e';\necho $shoeSize-\u003eto(ShoeSizeSystem::INCH) . '\u003cbr\u003e';\n```\n\nSample output:\n\n```\n1.00 m\n1.30 m\n5.70 m\n6.23 yd\n\n1,000.00 MB\n8388629474.89 b\n7.81 Gb\n0.0009534451 TB\n\n0xff\n255\no377\nb11111111\n\n40 cm\n4 US\n4 7/8 UK\n15.748 in\n\n20 EUR\n4.5 - 5 US\n3.5 - 4 UK\n4.625 in\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcniska%2Fphp-conversion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcniska%2Fphp-conversion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcniska%2Fphp-conversion/lists"}