{"id":13623872,"url":"https://github.com/Crisu83/php-conversion","last_synced_at":"2025-04-15T20:32:40.634Z","repository":{"id":409076,"uuid":"13691428","full_name":"crisu83/php-conversion","owner":"crisu83","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":130,"open_issues_count":5,"forks_count":19,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-30T00:39:50.647Z","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/crisu83.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":"2024-06-24T17:52:35.000Z","dependencies_parsed_at":"2022-08-16T10:25:08.354Z","dependency_job_id":null,"html_url":"https://github.com/crisu83/php-conversion","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crisu83%2Fphp-conversion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crisu83%2Fphp-conversion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crisu83%2Fphp-conversion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crisu83%2Fphp-conversion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crisu83","download_url":"https://codeload.github.com/crisu83/php-conversion/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223684833,"owners_count":17185718,"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":[],"created_at":"2024-08-01T21:01:36.559Z","updated_at":"2024-11-08T12:30:26.916Z","avatar_url":"https://github.com/crisu83.png","language":"PHP","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","funding_links":[],"categories":["数字","目录","Table of Contents","PHP","数字 Numbers","Text and Numbers","Numbers","数字( Numbers )"],"sub_categories":["数字 Numbers","Numbers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCrisu83%2Fphp-conversion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCrisu83%2Fphp-conversion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCrisu83%2Fphp-conversion/lists"}