-
-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated readme
- Loading branch information
Martin Kluska
committed
Jan 17, 2017
1 parent
a249add
commit 512eb08
Showing
3 changed files
with
87 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Martin Kluska <[email protected]> | ||
|
||
> 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters