Tür Tanımlayıcı
"Veritabanından sorgu isteğini tamamlamak için kullanılan get() yöntemi yerine doğrudan tabloismi() biçiminde tanımlama yapabilirsiniz. Örnek: DB::users();"
Bu kütüphane dosyaların türleri hakkında bilgi verir.
# Kurulum
ZN dağıtımları için kurulum gerekmez.
↓ composer require znframework/package-helpers
# Yöntemler
Mime::__call() : mixed |
Mime::isCall(string $file) : bool |
Mime::type(string $file) : string |
# __Call
Uzantıya göre dosyanın mime değerini verir. Dosya türü öğrenilmek istenen dosya uzantısı yöntem adı olarak kullanılır.
Parametreler
return mixed |
Kullanımlar
output( Mime::avi() );
1 => string 'video/msvideo' ( length = 15 )
2 => string 'video/avi' ( length = 11 )
3 => string 'application/x-troff-msvideo' ( length = 29 )
echo Mime::aac();
# IsCall
Dosyanın türünün doğruluğunu kontrol etmek için kullanılır. Mime::is deyiminden sonra kontrol etmek istenilen ifadenin bilgisi yazılır. Örneğin: Mime::isImage($file) gibi.
Parametreler
string $file | Dosya yolu. |
return bool |
Kullanımlar
if( Mime::isImage($file) )
{
}
Örneğin application/octet-stream mimesine sahip olan bir dosyayı bu terimdeki herhangi bir ifadeye göre kontrol etmeniz mümkün.
echo Mime::isOctet($file);
echo Mime::isStream($file);
echo Mime::isApplication($file);
echo Mime::isApp($file);
1
1
1
Yani mime türü terimi içerisinde geçen ifadelere göre kontrol yapmanız mümkündür.
# Type
Dosyanın mime türünü verir.
Parametreler
string $file | Dosya yolu. |
return string |
Kullanımlar
echo Mime::type('images/example.png');
# Tanımlı Tür Listesi
Listeyi genişletmek için aşağıdaki dosyada yer alan mimeTypes dizisinden istifade edebilirsiniz.
string | $acc | 'audio/x-acc' |
string | $ac3 | 'audio/ac3' |
array | $ai | 'application/pdf' 'application/postscript' |
string | $aifc | 'audio/x-aiff' |
array | $aif | 'audio/x-aiff' 'audio/aiff' |
array | $aiff | 'audio/x-aiff' 'audio/aiff' |
string | $au | 'audio/x-au' |
array | $avi | 'video/x-msvideo' 'video/msvideo' 'video/avi' 'application/x-troff-msvideo' |
array | $bin | 'application/macbinary' 'application/mac-binary' 'application/octet-stream' 'application/x-binary' 'application/x-macbinary' |
array | $bmp | 'image/bmp' 'image/x-bmp' 'image/x-bitmap' 'image/x-xbitmap' 'image/x-win-bitmap' 'image/x-windows-bmp' 'image/ms-bmp' 'image/x-ms-bmp' 'application/bmp' 'application/x-bmp' 'application/x-win-bitmap' |
array | $cdr | 'application/cdr' 'application/coreldraw' 'application/x-cdr' 'application/x-coreldraw' 'image/cdr' 'image/x-cdr' 'zz-application/zz-winassoc-cdr' |
array | $cer | 'application/pkix-cert' 'application/x-x509-ca-cert' |
string | $class | 'application/octet-stream' |
string | $cpt | 'application/mac-compactpro' |
array | $crl | 'application/pkix-crl' 'application/pkcs-crl' |
array | $crt | 'application/x-x509-ca-cert' 'application/x-x509-user-cert' 'application/pkix-cert' |
string | $csr | 'application/octet-stream' |
array | $css | 'text/css' 'text/plain' |
array | $csv | 'text/x-comma-separated-values' 'text/comma-separated-values' 'application/octet-stream' 'application/vnd.ms-excel' 'application/x-csv' 'text/x-csv' 'text/csv' 'application/csv' 'application/excel' 'application/vnd.msexcel' 'text/plain' |
string | $dcr | 'application/x-director' |
string | $der | 'application/x-x509-ca-cert' |
string | $dir | 'application/x-director' |
string | $dll | 'application/octet-stream' |
string | $dms | 'application/octet-stream' |
array | $doc | 'application/msword' 'application/vnd.ms-office' |
array | $docx | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' 'application/zip' 'application/msword' 'application/x-zip' |
array | $dot | 'application/msword' 'application/vnd.ms-office' |
array | $dotx | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' 'application/zip' 'application/msword' |
string | $dvi | 'application/x-dvi' |
string | $dxr | 'application/x-director' |
string | $eml | 'message/rfc822' |
string | $eps | 'application/postscript' |
array | $exe | 'application/octet-stream' 'application/x-msdownload' |
string | $flac | 'audio/x-flac' |
string | $f4v | 'video/mp4' |
string | $gif | 'image/gif' |
string | $gpg | 'application/gpg-keys' |
string | $gtar | 'application/x-gtar' |
string | $gz | 'application/x-gzip' |
string | $gzip | 'application/x-gzip' |
array | $hqx | 'application/mac-binhex40' 'application/mac-binhex' 'application/x-binhex40' 'application/x-mac-binhex40' |
array | $htm | 'text/html' 'text/plain' |
array | $html | 'text/html' 'text/plain' |
string | $ical | 'text/calendar' |
string | $ico | 'image/x-icon' |
string | $ics | 'text/calendar' |
array | $jar | 'application/java-archive' 'application/x-java-application' 'application/x-jar' 'application/x-compressed' |
array | $jpeg | 'image/jpeg' 'image/pjpeg' |
array | $jpg | 'image/jpeg' 'image/pjpeg' |
array | $js | 'application/x-javascript' 'text/plain' |
array | $json | 'application/json' 'text/json' |
string | $lha | 'application/octet-stream' |
array | $log | 'text/plain' 'text/x-log' |
string | $lzh | 'application/octet-stream' |
string | $kdb | 'application/octet-stream' |
array | $kml | 'application/vnd.google-earth.kml+xml' 'application/xml' 'text/xml' |
array | $kmz | 'application/vnd.google-earth.kmz' 'application/zip' 'application/x-zip' |
string | $mid | 'audio/midi' |
string | $midi | 'audio/midi' |
string | $mif | 'application/vnd.mif' |
string | $mov | 'video/quicktime' |
string | $movie | 'video/x-sgi-movie' |
string | $mpeg | 'video/mpeg' |
string | $mpg | 'video/mpeg' |
string | $mpga | 'video/mpeg' |
string | $mp2 | 'video/mpeg' |
array | $mp3 | 'audio/mpeg' 'audio/mpg' 'audio/mpeg3' 'audio/mp3' |
string | $mp4 | 'video/mp4' |
string | $m3u | 'text/plain' |
string | $m4a | 'audio/x-m4a' |
string | $m4u | 'application/vnd.mpegurl' |
string | $oda | 'application/oda' |
string | $ogg | 'audio/ogg' |
array | 'application/pdf' 'application/force-download' 'application/x-download' 'binary/octet-stream' |
|
array | $pem | 'application/x-x509-user-cert' 'application/x-pem-file' 'application/octet-stream' |
string | $pgp | 'application/pgp' |
array | $php | 'application/x-httpd-php' 'application/php' 'application/x-php' 'text/php' 'text/x-php' 'application/x-httpd-php-source' |
string | $php5 | 'application/x-httpd-php-source' |
string | $phtml | 'application/x-httpd-php' |
array | $png | 'image/png' 'image/x-png' |
array | $ppt | 'application/powerpoint' 'application/vnd.ms-powerpoint' 'application/vnd.ms-office' 'application/msword' |
array | $pptx | 'application/vnd.openxmlformats-officedocument.presentationml.presentation' 'application/x-zip' 'application/zip' |
string | $ps | 'application/postscript' |
array | $psd | 'application/x-photoshop' 'image/vnd.adobe.photoshop' |
array | $p10 | 'application/x-pkcs10' 'application/pkcs10' |
string | $p12 | 'application/x-pkcs12' |
string | $p7a | 'application/x-pkcs7-signature' |
array | $p7c | 'application/pkcs7-mime' 'application/x-pkcs7-mime' |
array | $p7m | 'application/pkcs7-mime' 'application/x-pkcs7-mime' |
string | $p7r | 'application/x-pkcs7-certreqresp' |
string | $p7s | 'application/pkcs7-signature' |
string | $qt | 'video/quicktime' |
string | $ra | 'audio/x-realaudio' |
string | $ram | 'audio/x-pn-realaudio' |
array | $rar | 'application/x-rar' 'application/rar' 'application/x-rar-compressed' |
string | $rm | 'audio/x-pn-realaudio' |
string | $rpm | 'audio/x-pn-realaudio-plugin' |
string | $rsa | 'application/x-pkcs7' |
string | $rtf | 'text/rtf' |
string | $rtx | 'text/richtext' |
string | $rv | 'video/vnd.rn-realvideo' |
string | $sea | 'application/octet-stream' |
array | $shtml | 'text/html' 'text/plain' |
string | $sit | 'application/x-stuffit' |
string | $smi | 'application/smil' |
string | $smil | 'application/smil' |
string | $so | 'application/octet-stream' |
array | $srt | 'text/srt' 'text/plain' |
string | $sst | 'application/octet-stream' |
array | $svg | 'image/svg+xml' 'application/xml' 'text/xml' |
string | $swf | 'application/x-shockwave-flash' |
string | $tar | 'application/x-tar' |
string | $text | 'text/plain' |
array | $tgz | 'application/x-tar' 'application/x-gzip-compressed' |
string | $tif | 'image/tiff' |
string | $tiff | 'image/tiff' |
string | $txt | 'text/plain' |
string | $vcf | 'text/x-vcard' |
string | $vlc | 'application/videolan' |
array | $vtt | 'text/vtt' 'text/plain' |
array | $wav | 'audio/x-wav' 'audio/wave' 'audio/wav' |
string | $wbxml | 'application/wbxml' |
string | $webm | 'video/webm' |
array | $wma | 'audio/x-ms-wma' 'video/x-ms-asf' |
string | $wmlc | 'application/wmlc' |
array | $wmv | 'video/x-ms-wmv' 'video/x-ms-asf' |
array | $word | 'application/msword' 'application/octet-stream' |
string | $xht | 'application/xhtml+xml' |
string | $xhtml | 'application/xhtml+xml' |
string | $xl | 'application/excel' |
array | $xls | 'application/vnd.ms-excel' 'application/msexcel' 'application/x-msexcel' 'application/x-ms-excel' 'application/x-excel' 'application/x-dos_ms_excel' 'application/xls' 'application/x-xls' 'application/excel' 'application/download' 'application/vnd.ms-office' 'application/msword' |
array | $xlsx | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' 'application/zip' 'application/vnd.ms-excel' 'application/msword' 'application/x-zip' |
array | $xml | 'application/xml' 'text/xml' 'text/plain' |
array | $xsl | 'application/xml' 'text/xsl' 'text/xml' |
string | $xspf | 'application/xspf+xml' |
string | $z | 'application/x-compress' |
array | $zip | 'application/x-zip' 'application/zip' 'application/x-zip-compressed' 'application/s-compressed' 'multipart/x-zip' |
string | $zsh | 'text/x-scriptzsh' |
array | $3gp | 'video/3gp' 'video/3gpp' |
string | $3g2 | 'video/3gpp2' |
array | $7zip | 'application/x-compressed' 'application/x-zip-compressed' 'application/zip' 'multipart/x-zip' |