{"id":13704312,"url":"https://github.com/dflydev/dflydev-apache-mime-types","last_synced_at":"2025-07-31T01:41:06.022Z","repository":{"id":5792561,"uuid":"7006874","full_name":"dflydev/dflydev-apache-mime-types","owner":"dflydev","description":"Apache MIME Types","archived":false,"fork":false,"pushed_at":"2020-02-13T14:23:06.000Z","size":77,"stargazers_count":70,"open_issues_count":3,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-27T08:54:15.262Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/dflydev.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-12-04T21:05:24.000Z","updated_at":"2025-01-29T19:31:57.000Z","dependencies_parsed_at":"2022-08-21T09:50:47.578Z","dependency_job_id":null,"html_url":"https://github.com/dflydev/dflydev-apache-mime-types","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/dflydev/dflydev-apache-mime-types","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-apache-mime-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-apache-mime-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-apache-mime-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-apache-mime-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dflydev","download_url":"https://codeload.github.com/dflydev/dflydev-apache-mime-types/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-apache-mime-types/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267973260,"owners_count":24174401,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"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":"2024-08-02T21:01:07.331Z","updated_at":"2025-07-31T01:41:05.994Z","avatar_url":"https://github.com/dflydev.png","language":"PHP","readme":"Apache MIME Types\n=================\n\nParses Apache MIME Types files and provides a simple interface to find\nextensions by type and type by extension.\n\n[![Build Status](https://travis-ci.org/dflydev/dflydev-apache-mime-types.png?branch=master)](https://travis-ci.org/dflydev/dflydev-apache-mime-types)\n\n\nFeatures\n--------\n\n * Bundles `mime.types` from the Apache HTTP Project. ([see here][1])\n * Bundles a JSON representation of Apache `mime.types`.\n * Provides an interface for reading either flat Apache HTTP `mime.types`\n   or a JSON representation.\n\n\nRequirements\n------------\n\n * PHP 5.3.3+\n\n\nInstallation\n------------\n\nThrough [Composer][3] as [dflydev/apache-mime-types][4].\n\n\nUsage\n-----\n\n### Parser\n\nParses Apache MIME Types in the format of `mime.types` [found here][1].\n\n```php\n\u003c?php\n$parser = new Dflydev\\ApacheMimeTypes\\Parser;\n\n$map = $parser-\u003eparse('/path/to/mime.types');\n```\n\nThe return value from `parse` is an array mapping types to an array of\nextensions.\n\n```php\n\u003c?php\narray(\n    'text/html' =\u003e array('html', 'htm'),\n);\n```\n\n\n### PhpRepository\n\nA repository backed by static PHP arrays.\n\n```php\n\u003c?php\n$repository = new Dflydev\\ApacheMimeTypes\\PhpRepository;\n\n$type = $repository-\u003efindType('html');\n$extensions = $repository-\u003efindExtensions('text/html');\n\nvar_dump($type);\nvar_dump($extensions);\n\n//\n// Result\n//\n// string(9) \"text/html\"\n// array(2) {\n//   [0]=\u003e\n//   string(4) \"html\"\n//   [1]=\u003e\n//   string(3) \"htm\"\n// }\n//\n```\n\n\n### JsonRepository\n\nA repository backed by a JSON map of type to extensions.\n\n```json\n{\n    \"text/html\": [\"html\", \"htm\"]\n}\n```\n\nTo use the embedded JSON:\n\n```php\n\u003c?php\n$repository = new Dflydev\\ApacheMimeTypes\\JsonRepository;\n\n$type = $repository-\u003efindType('html');\n$extensions = $repository-\u003efindExtensions('text/html');\n\nvar_dump($type);\nvar_dump($extensions);\n\n//\n// Result\n//\n// string(9) \"text/html\"\n// array(2) {\n//   [0]=\u003e\n//   string(4) \"html\"\n//   [1]=\u003e\n//   string(3) \"htm\"\n// }\n//\n```\n\nTo specify a specific JSON mapping:\n\n```php\n\u003c?php\n$repository = new Dflydev\\ApacheMimeTypes\\JsonRepository('/path/to/mime.types.json');\n```\n\n### FlatRepository\n\nA repository backed by Apache MIME Types formatted `mime.types`. To use the embedded\n`mime.types`:\n\n```php\n\u003c?php\n$repository = new Dflydev\\ApacheMimeTypes\\FlatRepository;\n\n$type = $repository-\u003efindType('html');\n$extensions = $repository-\u003efindExtensions('text/html');\n\nvar_dump($type);\nvar_dump($extensions);\n\n//\n// Result\n//\n// string(9) \"text/html\"\n// array(2) {\n//   [0]=\u003e\n//   string(4) \"html\"\n//   [1]=\u003e\n//   string(3) \"htm\"\n// }\n//\n```\n\nTo specify a specific `mime.types` mapping:\n\n```php\n\u003c?php\n$repository = new Dflydev\\ApacheMimeTypes\\FlatRepository('/path/to/mime.types');\n```\n\n\nLicense\n-------\n\nMIT, see LICENSE.\n\n\nCommunity\n---------\n\nIf you have questions or want to help out, join us in the **#dflydev** channel\non **irc.freenode.net**.\n\n\nNot Invented Here\n-----------------\n\nThis project is based heavily on [skyzyx/mimetypes][2]. The major difference is\nthat [skyzyx/mimetypes][2] is focussed on creating JSON files from Apache\n`mime.types` rather than providing a way to interact with Apache MIME Types as\na data source.\n\n\n[1]: https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types\n[2]: https://github.com/skyzyx/mimetypes\n[3]: http://getcomposer.org/\n[4]: https://packagist.org/packages/dflydev/apache-mime-types\n","funding_links":[],"categories":["Files","文件","文件 Files","目录","文件操作( Files )"],"sub_categories":["文件 Files"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflydev%2Fdflydev-apache-mime-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdflydev%2Fdflydev-apache-mime-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflydev%2Fdflydev-apache-mime-types/lists"}