Skip to content

Commit 512eb08

Browse files
author
Martin Kluska
committed
added license and contributing
updated readme
1 parent a249add commit 512eb08

File tree

3 files changed

+87
-34
lines changed

3 files changed

+87
-34
lines changed

CONTRIBUTING.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Contribution or overriding
2+
Are welcome. To add a new provider just add a new Handler (which extends AbstractHandler). Then implement the chunk
3+
upload and progress.
4+
5+
1. Fork the project.
6+
2. Create your bugfix/feature branch and write your (try well-commented) code.
7+
3. Commit your changes (and your tests) and push to your branch.
8+
4. Create a new pull request against this package's `master` branch.
9+
10+
## Pull Requests
11+
12+
- **Use the [PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md).**
13+
The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
14+
15+
- **Consider our release cycle.** We try to follow [SemVer v2.0.0](http://semver.org/).
16+
17+
- **Document any change in behaviour.** Make sure the `README.md` and any other relevant
18+
documentation are kept up-to-date.
19+
20+
- **Create feature branches.** Don't ask us to pull from your master branch.
21+
22+
- **One pull request per feature.** If you want to do more than one thing, send multiple pull requests.
23+
24+
**Thank you!**
25+
26+
# Handler class
27+
The basic handler `AbstractHandler` allows to implement own detection of the chunk mode and file naming. Stored in the Handler namespace but you can
28+
store your handler at any namespace (you need to pass the class to the `FileReceiver` as a parameter)
29+
30+
### You must implement:
31+
32+
- `getChunkFileName()` - Returns the chunk file name for a storing the tmp file
33+
- `isFirstChunk()` - Checks if the request has first chunk
34+
- `isLastChunk()` - Checks if the current request has the last chunk
35+
- `isChunkedUpload()` - Checks if the current request is chunked upload
36+
- `getPercentageDone()` - Calculates the current uploaded percentage
37+
38+
### Automatic detection
39+
To enable your own detection, just overide the `canBeUsedForRequest` method
40+
41+
```php
42+
public static function canBeUsedForRequest(Request $request)
43+
{
44+
return true;
45+
}
46+
```
47+
48+
# Fork
49+
Edit the `HandlerFactory` and add your handler to the `$handlers` array
50+
51+
# At runtime or without forking
52+
Call the `HandlerFactory::register($name)` to register your own Handler at runtime and use it

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The MIT License (MIT)
2+
3+
Copyright (c) 2016 Martin Kluska <[email protected]>
4+
5+
> Permission is hereby granted, free of charge, to any person obtaining a copy
6+
> of this software and associated documentation files (the "Software"), to deal
7+
> in the Software without restriction, including without limitation the rights
8+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
> copies of the Software, and to permit persons to whom the Software is
10+
> furnished to do so, subject to the following conditions:
11+
>
12+
> The above copyright notice and this permission notice shall be included in all
13+
> copies or substantial portions of the Software.
14+
>
15+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
> SOFTWARE.

readme.md

+14-34
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ Easy to use service for chunked upload with several js providers on top of Larav
1717
* [Route](#route)
1818
* [Providers/Handlers](#providers-handlers)
1919
* [Changelog](#changelog)
20-
* [Contribution](#contribution)
20+
* [Contribution or overriding](#contribution-or-overriding)
21+
* [Suggested frontend libs](#suggested-frontend-libs)
2122

22-
## Instalation
23+
## Installation
2324

2425
**Install via composer**
2526

@@ -247,7 +248,7 @@ When using uploader for the cross domain request you must setup the `chunk.name.
247248
Then setup your laravel [Setup guide](https://github.com/barryvdh/laravel-cors)
248249

249250
## Providers/Handlers
250-
Use `AbstractHandler` for type hint or use a specific handler to se aditional methods.
251+
Use `AbstractHandler` for type hint or use a specific handler to se additional methods.
251252

252253
### ContentRangeUploadHandler
253254

@@ -313,40 +314,19 @@ The cloud drive is not supported becouse of the chunked write (probably could be
313314
- [ ] add an example project
314315
- [ ] add support to different drive than a local drive
315316

316-
## Contribution
317-
Are welcome. To add a new provider, just add a new Handler (which extends AbstractHandler), implement the chunk
318-
upload and progress
319-
320-
### Handler class
321-
The basic handler `AbstractHandler` allows to implement own detection of the chunk mode and file naming. Stored in the Handler namespace but you can
322-
store your handler at any namespace (you need to pass the class to the `FileReceiver` as a parameter)
323-
324-
#### You must implement:
325-
326-
- `getChunkFileName()` - Returns the chunk file name for a storing the tmp file
327-
- `isFirstChunk()` - Checks if the request has first chunk
328-
- `isLastChunk()` - Checks if the current request has the last chunk
329-
- `isChunkedUpload()` - Checks if the current request is chunked upload
330-
- `getPercentageDone()` - Calculates the current uploaded percentage
331-
332-
#### Automatic detection
333-
To enable your own detection, just overide the `canBeUsedForRequest` method
334-
335-
```php
336-
public static function canBeUsedForRequest(Request $request)
337-
{
338-
return true;
339-
}
340-
```
341-
342-
##### Fork
343-
Edit the `HandlerFactory` and add your handler to the `$handlers` array
344-
345-
##### At runtime or without forking
346-
Call the `HandlerFactory::register()` to register your own Handler
317+
## Contribution or overriding
318+
See [CONTRIBUTING.md](CONTRIBUTING.md) for how to contribute changes. All contributions are welcome.
347319

348320
# Suggested frontend libs
349321

350322
* https://github.com/lemonCMS/react-plupload
351323
* https://github.com/moxiecode/plupload
352324
* https://github.com/blueimp/jQuery-File-Upload
325+
326+
## Copyright and License
327+
328+
[laravel-chunk-upload](https://github.com/pionl/laravel-chunk-upload)
329+
was written by [Martin Kluska](http://kluska.cz) and is released under the
330+
[MIT License](LICENSE.md).
331+
332+
Copyright (c) 2016 Martin Kluska

0 commit comments

Comments
 (0)