{"id":15916878,"url":"https://github.com/lib16/utils-php","last_synced_at":"2026-03-10T03:34:11.387Z","repository":{"id":62517014,"uuid":"74206124","full_name":"lib16/utils-php","owner":"lib16","description":"Some utility classes.","archived":false,"fork":false,"pushed_at":"2021-02-14T12:18:39.000Z","size":48,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-01T16:54:38.143Z","etag":null,"topics":["css-units","mime-types","php7"],"latest_commit_sha":null,"homepage":null,"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/lib16.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":"2016-11-19T12:05:59.000Z","updated_at":"2022-02-12T12:48:02.000Z","dependencies_parsed_at":"2022-11-02T10:32:08.252Z","dependency_job_id":null,"html_url":"https://github.com/lib16/utils-php","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/lib16/utils-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lib16%2Futils-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lib16%2Futils-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lib16%2Futils-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lib16%2Futils-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lib16","download_url":"https://codeload.github.com/lib16/utils-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lib16%2Futils-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30323222,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T01:36:58.598Z","status":"online","status_checked_at":"2026-03-10T02:00:06.579Z","response_time":106,"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":["css-units","mime-types","php7"],"created_at":"2024-10-06T18:06:10.951Z","updated_at":"2026-03-10T03:34:11.364Z","avatar_url":"https://github.com/lib16.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `lib16/utils-php`\n\nSome utility classes for lib16.\n\n[![Build Status](https://travis-ci.com/lib16/utils-php.svg?branch=master)](https://travis-ci.com/lib16/utils-php)\n[![Coverage](https://codecov.io/gh/lib16/utils-php/branch/master/graph/badge.svg)](https://codecov.io/gh/lib16/utils-php)\n\n## Installation with Composer\nThis package is available on [packagist](https://packagist.org/packages/lib16/utils), so you can use [Composer](https://getcomposer.org) to install it.\nRun the following command in your shell:\n\n```\ncomposer require lib16/utils\n```\n\n## Enums\n\n### CSS Units\n```php\n\u003c?php\nrequire_once 'vendor/autoload.php';\n\nuse Lib16\\Utils\\Enums\\CSS\\{LengthUnit, AngleUnit, TimeUnit, FrequencyUnit};\n\nprint 1 . LengthUnit::EM() . ' ';\nprint 2 . LengthUnit::EX() . ' ';\nprint 2 . LengthUnit::CH() . ' ';\nprint 6 . LengthUnit::REM() . \"\\n\";\n\nprint 50 . LengthUnit::VW() . ' ';\nprint 50 . LengthUnit::VH() . ' ';\nprint 50 . LengthUnit::VMIN() . ' ';\nprint 50 . LengthUnit::VMAX() . \"\\n\";\n\nprint 2.54 . LengthUnit::CM() . ' ';\nprint 25.4 . LengthUnit::MM() . ' ';\nprint 101.6 . LengthUnit::Q() . ' ';\nprint 1 . LengthUnit::IN() . ' ';\nprint 6 . LengthUnit::PC() . ' ';\nprint 72 . LengthUnit::PT() . ' ';\nprint 96 . LengthUnit::PX() . \"\\n\";\n\nprint 150 . LengthUnit::PERCENT() . ' ';\nprint 1.5 . LengthUnit::NONE() . \"\\n\";\n\nprint 90 . AngleUnit::DEG() . ' ';\nprint 100 . AngleUnit::GRAD() . ' ';\nprint 1.57 . AngleUnit::RAD() . ' ';\nprint 0.25 . AngleUnit::TURN() . \"\\n\";\n\nprint 0.5 . TimeUnit::S() . ' ';\nprint 500 . TimeUnit::MS() . \"\\n\";\n\nprint 1 . FrequencyUnit::KHZ() . ' ';\nprint 1000 . FrequencyUnit::HZ();\n```\n\nthe generated output:\n\n```\n1em 2ex 2ch 6rem\n50vw 50vh 50vmin 50vmax\n2.54cm 25.4mm 101.6Q 1in 6pc 72pt 96px\n150% 1.5\n90deg 100grad 1.57rad 0.25turn\n0.5s 500ms\n1kHz 1000Hz\n```\n\n\n### CSS Media Types\n```php\n\u003c?php\nrequire_once 'vendor/autoload.php';\n\nuse Lib16\\Utils\\Enums\\CSS\\Media;\n\nprint Media::ALL() . ' ';\nprint Media::BRAILLE() . ' ';\nprint Media::EMBOSSED() . ' ';\nprint Media::HANDHELD() . ' ';\nprint Media::PRINT() . ' ';\nprint Media::PROJECTION() . ' ';\nprint Media::SCREEN() . ' ';\nprint Media::SPEECH() . ' ';\nprint Media::TTY() . ' ';\nprint Media::TV();\n\n```\n\nthe generated output:\n\n```\nall braille embossed handheld print projection screen speech tty tv\n```\n\n\n### MIME Types\n```php\n\u003c?php\nrequire_once 'vendor/autoload.php';\n\nuse Lib16\\Utils\\Enums\\Mime\\{ImageType, IconType, VideoType, AudioType, StyleType};\n\nprint ImageType::GIF()-\u003egetFilenameExtension() . ': ';\nprint ImageType::GIF() . \"\\n\";\nprint ImageType::JPG()-\u003egetFilenameExtension() . ': ';\nprint ImageType::JPG() . \"\\n\";\nprint ImageType::PNG()-\u003egetFilenameExtension() . ': ';\nprint ImageType::PNG() . \"\\n\";\nprint ImageType::SVG()-\u003egetFilenameExtension() . ': ';\nprint ImageType::SVG() . \"\\n\\n\";\n\nprint IconType::GIF()-\u003egetFilenameExtension() . ': ';\nprint IconType::GIF() . \"\\n\";\nprint IconType::ICO()-\u003egetFilenameExtension() . ': ';\nprint IconType::ICO() . \"\\n\";\nprint IconType::PNG()-\u003egetFilenameExtension() . ': ';\nprint IconType::PNG() . \"\\n\";\nprint IconType::SVG()-\u003egetFilenameExtension() . ': ';\nprint IconType::SVG() . \"\\n\\n\";\n\nprint VideoType::MP4()-\u003egetFilenameExtension() . ': ';\nprint VideoType::MP4() . \"\\n\";\nprint VideoType::OGV()-\u003egetFilenameExtension() . ': ';\nprint VideoType::OGV() . \"\\n\";\nprint VideoType::WEBM()-\u003egetFilenameExtension() . ': ';\nprint VideoType::WEBM() . \"\\n\\n\";\n\nprint AudioType::AAC()-\u003egetFilenameExtension() . ': ';\nprint AudioType::AAC() . \"\\n\";\nprint AudioType::MP3()-\u003egetFilenameExtension() . ': ';\nprint AudioType::MP3() . \"\\n\";\nprint AudioType::OGG()-\u003egetFilenameExtension() . ': ';\nprint AudioType::OGG() . \"\\n\";\nprint AudioType::WAV()-\u003egetFilenameExtension() . ': ';\nprint AudioType::WAV() . \"\\n\\n\";\n\nprint StyleType::CSS()-\u003egetFilenameExtension() . ': ';\nprint StyleType::CSS() . \"\\n\";\nprint StyleType::XSL()-\u003egetFilenameExtension() . ': ';\nprint StyleType::XSL();\n\n```\n\nthe generated output:\n\n```\ngif: image/gif\njpg: image/jpeg\npng: image/png\nsvg: image/svg+xml\n\ngif: image/gif\nico: image/vnd.microsoft.icon\npng: image/png\nsvg: image/svg+xml\n\nmp4: video/mp4; codecs=avc1.42E01E,mp4a.40.2\nogv: video/ogg; codecs=theora,vorbis\nwebm: video/webm; codecs=vp8,vorbis\n\naac: audio/mp4; codecs=mp4a.40.2\nmp3: audio/mpeg\nogg: audio/ogg; codecs=vorbis\nwav: audio/wav\n\ncss: text/css\nxsl: text/xsl\n```\n\n\n### NumberFormatter\n```php\n\u003c?php\nrequire_once 'vendor/autoload.php';\n\nuse Lib16\\Utils\\NumberFormatter;\nuse Lib16\\Utils\\Enums\\CSS\\LengthUnit;\n\n$formatter = new NumberFormatter(2);\nprint $formatter-\u003eformat(100 / 6, LengthUnit::PX());\n\n```\n\nthe generated output:\n\n```\n16.67px\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flib16%2Futils-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flib16%2Futils-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flib16%2Futils-php/lists"}