口腔客户管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 6.5KB

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. # ZipStream-PHP
  2. [![Build Status](https://travis-ci.org/maennchen/ZipStream-PHP.svg?branch=master)](https://travis-ci.org/maennchen/ZipStream-PHP)
  3. [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/maennchen/ZipStream-PHP/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/maennchen/ZipStream-PHP/)
  4. [![Code Coverage](https://scrutinizer-ci.com/g/maennchen/ZipStream-PHP/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/maennchen/ZipStream-PHP/)
  5. [![Latest Stable Version](https://poser.pugx.org/maennchen/zipstream-php/v/stable)](https://packagist.org/packages/maennchen/zipstream-php)
  6. [![Total Downloads](https://poser.pugx.org/maennchen/zipstream-php/downloads)](https://packagist.org/packages/maennchen/zipstream-php)
  7. [![Financial Contributors on Open Collective](https://opencollective.com/zipstream/all/badge.svg?label=financial+contributors)](https://opencollective.com/zipstream) [![License](https://img.shields.io/github/license/maennchen/zipstream-php.svg)](LICENSE)
  8. ## Overview
  9. A fast and simple streaming zip file downloader for PHP. Using this library will save you from having to write the Zip to disk. You can directly send it to the user, which is much faster. It can work with S3 buckets or any PSR7 Stream.
  10. Please see the [LICENSE](LICENSE) file for licensing and warranty information.
  11. ## Installation
  12. Simply add a dependency on maennchen/zipstream-php to your project's composer.json file if you use Composer to manage the dependencies of your project. Use following command to add the package to your project's dependencies:
  13. ```bash
  14. composer require maennchen/zipstream-php
  15. ```
  16. ## Usage and options
  17. Here's a simple example:
  18. ```php
  19. // Autoload the dependencies
  20. require 'vendor/autoload.php';
  21. // enable output of HTTP headers
  22. $options = new ZipStream\Option\Archive();
  23. $options->setSendHttpHeaders(true);
  24. // create a new zipstream object
  25. $zip = new ZipStream\ZipStream('example.zip', $options);
  26. // create a file named 'hello.txt'
  27. $zip->addFile('hello.txt', 'This is the contents of hello.txt');
  28. // add a file named 'some_image.jpg' from a local file 'path/to/image.jpg'
  29. $zip->addFileFromPath('some_image.jpg', 'path/to/image.jpg');
  30. // add a file named 'goodbye.txt' from an open stream resource
  31. $fp = tmpfile();
  32. fwrite($fp, 'The quick brown fox jumped over the lazy dog.');
  33. rewind($fp);
  34. $zip->addFileFromStream('goodbye.txt', $fp);
  35. fclose($fp);
  36. // finish the zip stream
  37. $zip->finish();
  38. ```
  39. You can also add comments, modify file timestamps, and customize (or
  40. disable) the HTTP headers. It is also possible to specify the storage method when adding files,
  41. the current default storage method is 'deflate' i.e files are stored with Compression mode 0x08.
  42. See the [Wiki](https://github.com/maennchen/ZipStream-PHP/wiki) for details.
  43. ## Known issue
  44. The native Mac OS archive extraction tool might not open archives in some conditions. A workaround is to disable the Zip64 feature with the option `$opt->setEnableZip64(false)`. This limits the archive to 4 Gb and 64k files but will allow Mac OS users to open them without issue. See #116.
  45. The linux `unzip` utility might not handle properly unicode characters. It is recommended to extract with another tool like [7-zip](https://www.7-zip.org/). See #146.
  46. ## Upgrade to version 2.0.0
  47. * Only the self opened streams will be closed (#139)
  48. If you were relying on ZipStream to close streams that the library didn't open,
  49. you'll need to close them yourself now.
  50. ## Upgrade to version 1.0.0
  51. * All options parameters to all function have been moved from an `array` to structured option objects. See [the wiki](https://github.com/maennchen/ZipStream-PHP/wiki/Available-options) for examples.
  52. * The whole library has been refactored. The minimal PHP requirement has been raised to PHP 7.1.
  53. ## Usage with Symfony and S3
  54. You can find example code on [the wiki](https://github.com/maennchen/ZipStream-PHP/wiki/Symfony-example).
  55. ## Contributing
  56. ZipStream-PHP is a collaborative project. Please take a look at the [CONTRIBUTING.md](CONTRIBUTING.md) file.
  57. ## About the Authors
  58. * Paul Duncan <pabs@pablotron.org> - https://pablotron.org/
  59. * Jonatan Männchen <jonatan@maennchen.ch> - https://maennchen.dev
  60. * Jesse G. Donat <donatj@gmail.com> - https://donatstudios.com
  61. * Nicolas CARPi <nico-git@deltablot.email> - https://www.deltablot.com
  62. * Nik Barham <nik@brokencube.co.uk> - https://www.brokencube.co.uk
  63. ## Contributors
  64. ### Code Contributors
  65. This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
  66. <a href="https://github.com/maennchen/ZipStream-PHP/graphs/contributors"><img src="https://opencollective.com/zipstream/contributors.svg?width=890&button=false" /></a>
  67. ### Financial Contributors
  68. Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/zipstream/contribute)]
  69. #### Individuals
  70. <a href="https://opencollective.com/zipstream"><img src="https://opencollective.com/zipstream/individuals.svg?width=890"></a>
  71. #### Organizations
  72. Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/zipstream/contribute)]
  73. <a href="https://opencollective.com/zipstream/organization/0/website"><img src="https://opencollective.com/zipstream/organization/0/avatar.svg"></a>
  74. <a href="https://opencollective.com/zipstream/organization/1/website"><img src="https://opencollective.com/zipstream/organization/1/avatar.svg"></a>
  75. <a href="https://opencollective.com/zipstream/organization/2/website"><img src="https://opencollective.com/zipstream/organization/2/avatar.svg"></a>
  76. <a href="https://opencollective.com/zipstream/organization/3/website"><img src="https://opencollective.com/zipstream/organization/3/avatar.svg"></a>
  77. <a href="https://opencollective.com/zipstream/organization/4/website"><img src="https://opencollective.com/zipstream/organization/4/avatar.svg"></a>
  78. <a href="https://opencollective.com/zipstream/organization/5/website"><img src="https://opencollective.com/zipstream/organization/5/avatar.svg"></a>
  79. <a href="https://opencollective.com/zipstream/organization/6/website"><img src="https://opencollective.com/zipstream/organization/6/avatar.svg"></a>
  80. <a href="https://opencollective.com/zipstream/organization/7/website"><img src="https://opencollective.com/zipstream/organization/7/avatar.svg"></a>
  81. <a href="https://opencollective.com/zipstream/organization/8/website"><img src="https://opencollective.com/zipstream/organization/8/avatar.svg"></a>
  82. <a href="https://opencollective.com/zipstream/organization/9/website"><img src="https://opencollective.com/zipstream/organization/9/avatar.svg"></a>