From 512eb0818044f44c1639408627dd422ece523ebd Mon Sep 17 00:00:00 2001 From: Martin Kluska Date: Tue, 17 Jan 2017 18:38:06 +0100 Subject: [PATCH] added license and contributing updated readme --- CONTRIBUTING.md | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ LICENSE.md | 21 ++++++++++++++++++++ readme.md | 48 +++++++++++++-------------------------------- 3 files changed, 87 insertions(+), 34 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b7eebba --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,52 @@ +# Contribution or overriding +Are welcome. To add a new provider just add a new Handler (which extends AbstractHandler). Then implement the chunk +upload and progress. + +1. Fork the project. +2. Create your bugfix/feature branch and write your (try well-commented) code. +3. Commit your changes (and your tests) and push to your branch. +4. Create a new pull request against this package's `master` branch. + +## Pull Requests + +- **Use the [PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md).** + The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer). + +- **Consider our release cycle.** We try to follow [SemVer v2.0.0](http://semver.org/). + +- **Document any change in behaviour.** Make sure the `README.md` and any other relevant + documentation are kept up-to-date. + +- **Create feature branches.** Don't ask us to pull from your master branch. + +- **One pull request per feature.** If you want to do more than one thing, send multiple pull requests. + +**Thank you!** + +# Handler class +The basic handler `AbstractHandler` allows to implement own detection of the chunk mode and file naming. Stored in the Handler namespace but you can +store your handler at any namespace (you need to pass the class to the `FileReceiver` as a parameter) + +### You must implement: + +- `getChunkFileName()` - Returns the chunk file name for a storing the tmp file +- `isFirstChunk()` - Checks if the request has first chunk +- `isLastChunk()` - Checks if the current request has the last chunk +- `isChunkedUpload()` - Checks if the current request is chunked upload +- `getPercentageDone()` - Calculates the current uploaded percentage + +### Automatic detection +To enable your own detection, just overide the `canBeUsedForRequest` method + +```php +public static function canBeUsedForRequest(Request $request) +{ + return true; +} +``` + +# Fork +Edit the `HandlerFactory` and add your handler to the `$handlers` array + +# At runtime or without forking +Call the `HandlerFactory::register($name)` to register your own Handler at runtime and use it \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..398b97d --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +# The MIT License (MIT) + +Copyright (c) 2016 Martin Kluska + +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all +> copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE. \ No newline at end of file diff --git a/readme.md b/readme.md index 58a7f29..a3f9727 100644 --- a/readme.md +++ b/readme.md @@ -17,9 +17,10 @@ Easy to use service for chunked upload with several js providers on top of Larav * [Route](#route) * [Providers/Handlers](#providers-handlers) * [Changelog](#changelog) -* [Contribution](#contribution) +* [Contribution or overriding](#contribution-or-overriding) +* [Suggested frontend libs](#suggested-frontend-libs) -## Instalation +## Installation **Install via composer** @@ -247,7 +248,7 @@ When using uploader for the cross domain request you must setup the `chunk.name. Then setup your laravel [Setup guide](https://github.com/barryvdh/laravel-cors) ## Providers/Handlers -Use `AbstractHandler` for type hint or use a specific handler to se aditional methods. +Use `AbstractHandler` for type hint or use a specific handler to se additional methods. ### ContentRangeUploadHandler @@ -313,40 +314,19 @@ The cloud drive is not supported becouse of the chunked write (probably could be - [ ] add an example project - [ ] add support to different drive than a local drive -## Contribution -Are welcome. To add a new provider, just add a new Handler (which extends AbstractHandler), implement the chunk -upload and progress - -### Handler class -The basic handler `AbstractHandler` allows to implement own detection of the chunk mode and file naming. Stored in the Handler namespace but you can -store your handler at any namespace (you need to pass the class to the `FileReceiver` as a parameter) - -#### You must implement: - -- `getChunkFileName()` - Returns the chunk file name for a storing the tmp file -- `isFirstChunk()` - Checks if the request has first chunk -- `isLastChunk()` - Checks if the current request has the last chunk -- `isChunkedUpload()` - Checks if the current request is chunked upload -- `getPercentageDone()` - Calculates the current uploaded percentage - -#### Automatic detection -To enable your own detection, just overide the `canBeUsedForRequest` method - -```php -public static function canBeUsedForRequest(Request $request) -{ - return true; -} -``` - -##### Fork -Edit the `HandlerFactory` and add your handler to the `$handlers` array - -##### At runtime or without forking -Call the `HandlerFactory::register()` to register your own Handler +## Contribution or overriding +See [CONTRIBUTING.md](CONTRIBUTING.md) for how to contribute changes. All contributions are welcome. # Suggested frontend libs * https://github.com/lemonCMS/react-plupload * https://github.com/moxiecode/plupload * https://github.com/blueimp/jQuery-File-Upload + +## Copyright and License + +[laravel-chunk-upload](https://github.com/pionl/laravel-chunk-upload) +was written by [Martin Kluska](http://kluska.cz) and is released under the +[MIT License](LICENSE.md). + +Copyright (c) 2016 Martin Kluska \ No newline at end of file