https://github.com/decodelabs/typify
Mime type detection tools for PHP
https://github.com/decodelabs/typify
mime-types php
Last synced: 3 months ago
JSON representation
Mime type detection tools for PHP
- Host: GitHub
- URL: https://github.com/decodelabs/typify
- Owner: decodelabs
- License: mit
- Created: 2021-04-08T14:25:52.000Z (about 4 years ago)
- Default Branch: develop
- Last Pushed: 2025-04-09T21:33:18.000Z (3 months ago)
- Last Synced: 2025-04-09T22:07:42.611Z (3 months ago)
- Topics: mime-types, php
- Language: PHP
- Homepage:
- Size: 67.4 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Typify
[](https://packagist.org/packages/decodelabs/typify)
[](https://packagist.org/packages/decodelabs/typify)
[](https://packagist.org/packages/decodelabs/typify)
[](https://github.com/decodelabs/typify/actions/workflows/integrate.yml)
[](https://github.com/phpstan/phpstan)
[](https://packagist.org/packages/decodelabs/typify)### Mime type detection tools for PHP
Use typify to identify and apply mime types information to your files and responses.
---
## Installation
```bash
composer require decodelabs/typify
```## Usage
### Importing
Typify uses [Veneer](https://github.com/decodelabs/veneer) to provide a unified frontage under
DecodeLabs\Typify
.
You can access all the primary functionality via this static frontage without compromising testing and dependency injection.### Detecting types
Detect a mime type for a file path:
```php
use DecodeLabs\Typify;echo Typify::detect(__FILE__);
// application/x-php
```Get known extensions for a type:
```php
use DecodeLabs\Typify;$exts = Typify::getExtensionsFor('text/plain');
// txt, text, conf, def, list, log, in
```Suggest an extension for a mime type:
```php
use DecodeLabs\Typify;echo Typify::getExtensionFor('text/plain');
// txt
```## Licensing
Typify is licensed under the MIT License. See [LICENSE](./LICENSE) for the full license text.