{"id":13704320,"url":"https://github.com/hoaproject/Mime","last_synced_at":"2025-05-05T09:33:42.010Z","repository":{"id":4401620,"uuid":"5538837","full_name":"hoaproject/Mime","owner":"hoaproject","description":"The Hoa\\Mime library.","archived":true,"fork":false,"pushed_at":"2021-04-29T19:09:54.000Z","size":117,"stargazers_count":101,"open_issues_count":4,"forks_count":15,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-10-30T00:00:43.091Z","etag":null,"topics":["hoa","library","mime","mime-types","php"],"latest_commit_sha":null,"homepage":"https://hoa-project.net/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hoaproject.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-24T10:31:16.000Z","updated_at":"2024-03-27T04:20:04.000Z","dependencies_parsed_at":"2022-08-06T16:15:30.642Z","dependency_job_id":null,"html_url":"https://github.com/hoaproject/Mime","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoaproject%2FMime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoaproject%2FMime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoaproject%2FMime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoaproject%2FMime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoaproject","download_url":"https://codeload.github.com/hoaproject/Mime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224439889,"owners_count":17311543,"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":["hoa","library","mime","mime-types","php"],"created_at":"2024-08-02T21:01:07.477Z","updated_at":"2024-11-13T11:31:12.639Z","avatar_url":"https://github.com/hoaproject.png","language":"PHP","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://static.hoa-project.net/Image/Hoa.svg\" alt=\"Hoa\" width=\"250px\" /\u003e\n\u003c/p\u003e\n\n---\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://travis-ci.org/hoaproject/Mime\"\u003e\u003cimg src=\"https://img.shields.io/travis/hoaproject/Mime/master.svg\" alt=\"Build status\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://coveralls.io/github/hoaproject/Mime?branch=master\"\u003e\u003cimg src=\"https://img.shields.io/coveralls/hoaproject/Mime/master.svg\" alt=\"Code coverage\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://packagist.org/packages/hoa/mime\"\u003e\u003cimg src=\"https://img.shields.io/packagist/dt/hoa/mime.svg\" alt=\"Packagist\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://hoa-project.net/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/packagist/l/hoa/mime.svg\" alt=\"License\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  Hoa is a \u003cstrong\u003emodular\u003c/strong\u003e, \u003cstrong\u003eextensible\u003c/strong\u003e and\n  \u003cstrong\u003estructured\u003c/strong\u003e set of PHP libraries.\u003cbr /\u003e\n  Moreover, Hoa aims at being a bridge between industrial and research worlds.\n\u003c/p\u003e\n\n# Hoa\\Mime\n\n[![Help on IRC](https://img.shields.io/badge/help-%23hoaproject-ff0066.svg)](https://webchat.freenode.net/?channels=#hoaproject)\n[![Help on Gitter](https://img.shields.io/badge/help-gitter-ff0066.svg)](https://gitter.im/hoaproject/central)\n[![Documentation](https://img.shields.io/badge/documentation-hack_book-ff0066.svg)](https://central.hoa-project.net/Documentation/Library/Mime)\n[![Board](https://img.shields.io/badge/organisation-board-ff0066.svg)](https://waffle.io/hoaproject/mime)\n\nThis library allows to manipulate a MIME types database and get some related\ninformations about streams.\n\n[Learn more](https://central.hoa-project.net/Documentation/Library/Mime).\n\n## Installation\n\nWith [Composer](https://getcomposer.org/), to include this library into\nyour dependencies, you need to\nrequire [`hoa/mime`](https://packagist.org/packages/hoa/mime):\n\n```sh\n$ composer require hoa/mime '~3.0'\n```\n\nFor more installation procedures, please read [the Source\npage](https://hoa-project.net/Source.html).\n\n## Testing\n\nBefore running the test suites, the development dependencies must be installed:\n\n```sh\n$ composer install\n```\n\nThen, to run all the test suites:\n\n```sh\n$ vendor/bin/hoa test:run\n```\n\nFor more information, please read the [contributor\nguide](https://hoa-project.net/Literature/Contributor/Guide.html).\n\n## Quick usage\n\nAs a quick overview, we will see how to get general and stream-related\ninformations.\n\n### General informations\n\nAll we need is static methods `Hoa\\Mime\\Mime::getExtensionsFromMime` to get\nextensions from a type and `Hoa\\Mime\\Mime::getMimeFromExtension` to get type\nfrom an extension:\n\n```php\nprint_r(Hoa\\Mime\\Mime::getExtensionsFromMime('text/html'));\n\n/**\n * Will output:\n *     Array\n *     (\n *         [0] =\u003e html\n *         [1] =\u003e htm\n *     )\n */\n\nvar_dump(Hoa\\Mime\\Mime::getMimeFromExtension('webm'));\n\n/**\n * Will output:\n *     string(10) \"video/webm\"\n */\n```\n\nBy default, `Hoa\\Mime\\Mime` uses the `hoa://Library/Mime/Mime.types` file as\ndatabase. We can change this behavior by calling the `Hoa\\Mime\\Mime::compute`\nbefore any computations:\n\n```php\nHoa\\Mime\\Mime::compute('/etc/mime.types');\n```\n\n### Stream-related informations\n\nBy instanciating the `Hoa\\Mime\\Mime` class with a stream, we are able to get\nsome informations about the stream, such as its extension, others extensions,\ntype, etc. Thus:\n\n```php\n$type = new Hoa\\Mime\\Mime(new Hoa\\File\\Read('index.html'));\n\nvar_dump(\n    $type-\u003egetExtension(),\n    $type-\u003egetOtherExtensions(),\n    $type-\u003egetMime(),\n    $type-\u003eisExperimental()\n);\n\n/**\n * Will output:\n *     string(4) \"html\"\n *     array(1) {\n *       [0]=\u003e\n *       string(3) \"htm\"\n *     }\n *     string(9) \"text/html\"\n *     bool(false)\n */\n```\n\n## Documentation\n\nThe\n[hack book of `Hoa\\Mime`](https://central.hoa-project.net/Documentation/Library/Mime) contains\ndetailed information about how to use this library and how it works.\n\nTo generate the documentation locally, execute the following commands:\n\n```sh\n$ composer require --dev hoa/devtools\n$ vendor/bin/hoa devtools:documentation --open\n```\n\nMore documentation can be found on the project's website:\n[hoa-project.net](https://hoa-project.net/).\n\n## Getting help\n\nThere are mainly two ways to get help:\n\n  * On the [`#hoaproject`](https://webchat.freenode.net/?channels=#hoaproject)\n    IRC channel,\n  * On the forum at [users.hoa-project.net](https://users.hoa-project.net).\n\n## Contribution\n\nDo you want to contribute? Thanks! A detailed [contributor\nguide](https://hoa-project.net/Literature/Contributor/Guide.html) explains\neverything you need to know.\n\n## License\n\nHoa is under the New BSD License (BSD-3-Clause). Please, see\n[`LICENSE`](https://hoa-project.net/LICENSE) for details.\n\n## Related projects\n\nThe following projects are using this library:\n\n  * [E-Conf](https://gitlab.com/econf/econf), E-Conf is a Conference\n    Management System,\n  * [sabre/katana](https://github.com/fruux/sabre-katana/), A contact,\n    calendar, task list and file server.\n","funding_links":[],"categories":["文件","文件 Files","目录","Table of Contents","Files","文件操作( Files )"],"sub_categories":["文件 Files","Files"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoaproject%2FMime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoaproject%2FMime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoaproject%2FMime/lists"}