ZipConstants.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. namespace PhpZip\Constants;
  3. /**
  4. * Zip Constants.
  5. *
  6. * @author Ne-Lexa alexey@nelexa.ru
  7. * @license MIT
  8. */
  9. interface ZipConstants
  10. {
  11. /** @var int End Of Central Directory Record signature. */
  12. const END_CD = 0x06054B50; // "PK\005\006"
  13. /** @var int Zip64 End Of Central Directory Record. */
  14. const ZIP64_END_CD = 0x06064B50; // "PK\006\006"
  15. /** @var int Zip64 End Of Central Directory Locator. */
  16. const ZIP64_END_CD_LOC = 0x07064B50; // "PK\006\007"
  17. /** @var int Central File Header signature. */
  18. const CENTRAL_FILE_HEADER = 0x02014B50; // "PK\001\002"
  19. /** @var int Local File Header signature. */
  20. const LOCAL_FILE_HEADER = 0x04034B50; // "PK\003\004"
  21. /** @var int Data Descriptor signature. */
  22. const DATA_DESCRIPTOR = 0x08074B50; // "PK\007\008"
  23. /**
  24. * @var int value stored in four-byte size and similar fields
  25. * if ZIP64 extensions are used
  26. */
  27. const ZIP64_MAGIC = 0xFFFFFFFF;
  28. /**
  29. * Local File Header signature 4
  30. * Version Needed To Extract 2
  31. * General Purpose Bit Flags 2
  32. * Compression Method 2
  33. * Last Mod File Time 2
  34. * Last Mod File Date 2
  35. * CRC-32 4
  36. * Compressed Size 4
  37. * Uncompressed Size 4.
  38. *
  39. * @var int Local File Header filename position
  40. */
  41. const LFH_FILENAME_LENGTH_POS = 26;
  42. /**
  43. * The minimum length of the Local File Header record.
  44. *
  45. * local file header signature 4
  46. * version needed to extract 2
  47. * general purpose bit flag 2
  48. * compression method 2
  49. * last mod file time 2
  50. * last mod file date 2
  51. * crc-32 4
  52. * compressed size 4
  53. * uncompressed size 4
  54. * file name length 2
  55. * extra field length 2
  56. */
  57. const LFH_FILENAME_POS = 30;
  58. /** @var int the length of the Zip64 End Of Central Directory Locator */
  59. const ZIP64_END_CD_LOC_LEN = 20;
  60. /** @var int the minimum length of the End Of Central Directory Record */
  61. const END_CD_MIN_LEN = 22;
  62. /**
  63. * The minimum length of the Zip64 End Of Central Directory Record.
  64. *
  65. * zip64 end of central dir
  66. * signature 4
  67. * size of zip64 end of central
  68. * directory record 8
  69. * version made by 2
  70. * version needed to extract 2
  71. * number of this disk 4
  72. * number of the disk with the
  73. * start of the central directory 4
  74. * total number of entries in the
  75. * central directory on this disk 8
  76. * total number of entries in
  77. * the central directory 8
  78. * size of the central directory 8
  79. * offset of start of central
  80. * directory with respect to
  81. * the starting disk number 8
  82. *
  83. * @var int ZIP64 End Of Central Directory length
  84. */
  85. const ZIP64_END_OF_CD_LEN = 56;
  86. }