{"id":19356341,"url":"https://github.com/kamalkhan/download","last_synced_at":"2025-10-28T02:33:41.772Z","repository":{"id":62493912,"uuid":"256229741","full_name":"kamalkhan/download","owner":"kamalkhan","description":"Programmatically download files, zip archives and GitHub repositories","archived":false,"fork":false,"pushed_at":"2022-02-18T07:08:01.000Z","size":52,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-06T18:44:07.370Z","etag":null,"topics":["archive","downloader","file","github","repository","zip"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kamalkhan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-16T13:55:28.000Z","updated_at":"2022-02-18T07:05:50.000Z","dependencies_parsed_at":"2022-11-02T11:18:00.220Z","dependency_job_id":null,"html_url":"https://github.com/kamalkhan/download","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamalkhan%2Fdownload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamalkhan%2Fdownload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamalkhan%2Fdownload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamalkhan%2Fdownload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kamalkhan","download_url":"https://codeload.github.com/kamalkhan/download/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240468844,"owners_count":19806265,"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","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":["archive","downloader","file","github","repository","zip"],"created_at":"2024-11-10T07:04:05.285Z","updated_at":"2025-10-28T02:33:41.682Z","avatar_url":"https://github.com/kamalkhan.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Download [![Build Status][icon-status]][link-status] [![Total Downloads][icon-downloads]][link-downloads] [![MIT License][icon-license]](LICENSE.md)\n\nProgrammatically download files, zip archives and GitHub repositories.\n\n- [Requirements](#requirements)\n- [Install](#install)\n- [Usage](#usage)\n  - [Downloading a file](#downloading-a-file)\n  - [Downloading/extracting a zip archive](#downloadingextracting-a-zip-archive)\n  - [Downloading a GitHub repository](#downloading-a-github-repository)\n  - [Using a progress callback handler](#using-a-progress-callback-handler)\n- [Changelog](#changelog)\n- [Testing](#testing)\n- [Contributing](#contributing)\n- [Security](#security)\n- [Credits](#credits)\n- [License](#license)\n\n## Requirements\n\n- PHP \u003e= 5.6\n- PHP Zip Extension\n\n## Install\n\nYou may install this package using [composer][link-composer].\n\n```shell\n$ composer require bhittani/download --prefer-dist\n```\n\n## Usage\n\nThis package currently allows downloading/extraction of files (local/network), zip files (local/network) and [GitHub][link-github] repositories.\n\n### Downloading a file\n\nThe file downloader allows downloading of a single file either from a local disk or over a network.\n\n```php\n\u003c?php\nuse Bhittani\\Download\\File;\n\n// Create an instance of Bhittani\\Download\\File with the path to the source file.\n$file = new File('path/to/a/local/or/www/file.ext');\n\n// Download the file to a local destination.\n$file-\u003edownload('path/to/local/destination/file.ext');\n```\n\n### Downloading/extracting a zip archive\n\nThe zip downloader allows downloading of a zip file either from a local disk or over a network and extracting its contents into a local folder.\n\n```php\n\u003c?php\nuse Bhittani\\Download\\Zip;\n\n// Create an instance of Bhittani\\Download\\Zip with path to the source zip archive.\n$zip = new Zip('path/to/a/local/or/www/archive.zip');\n\n// Download and extract the zip archive to a local destination.\n$zip-\u003edownload('path/to/local/destination/folder');\n```\n\n### Downloading a GitHub repository\n\nThe GitHub downloader allows downloading of a GitHub repository into a local folder.\n\n```php\n\u003c?php\nuse Bhittani\\Download\\GitHub;\n\n// Create an instance of Bhittani\\Download\\GitHub with the name of respository.\n$gitHub = new GitHub('org/repo');\n\n// Download the GitHub repository to a local destination.\n$gitHub-\u003edownload('path/to/local/destination/folder');\n```\n\n### Using a progress callback handler\n\nThe download instances also accept a progress callback.\n\n```php\n$downloader = new \\Bhittani\\Download\\GitHub('org/repo');\n\n$downloader-\u003ecallback(function ($transferred, $total, $time) {\n    // $transferred will contain the number of bytes transferred.\n    // $total will contain the total bytes.\n    // $time will contain the time consumed in milliseconds.\n});\n\n$downloader-\u003edownload('path/to/destionation/folder');\n```\n\n\u003e An stdout progress callback is available as an invocable class `Bhittani\\Download\\Progress\\Standard` which may be useful for console output.\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed.\n\n## Testing\n\n```shell\ngit clone https://github.com/kamalkhan/download\n\ncd download\n\ncomposer install\n\ncomposer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email `shout@bhittani.com` instead of using the issue tracker.\n\n## Credits\n\n- [Kamal Khan](http://bhittani.com)\n- [All Contributors](https://github.com/kamalkhan/download/contributors)\n\n## License\n\nThe MIT License (MIT). Please see the [License File](LICENSE.md) for more information.\n\n\u003c!--Status--\u003e\n[icon-status]: https://img.shields.io/github/workflow/status/kamalkhan/download/main?style=flat-square\n[link-status]: https://github.com/kamalkhan/download\n\n\u003c!--Downloads--\u003e\n[icon-downloads]: https://img.shields.io/packagist/dt/bhittani/download.svg?style=flat-square\n[link-downloads]: https://packagist.org/packages/bhittani/download\n\n\u003c!--License--\u003e\n[icon-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n\n\u003c!--composer--\u003e\n[link-composer]: https://getcomposer.org\n\n\u003c!--github--\u003e\n[link-github]: https://github.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkamalkhan%2Fdownload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkamalkhan%2Fdownload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkamalkhan%2Fdownload/lists"}