Skip to content

Commit 2212c8e

Browse files
committed
Improve the readme / contribution
1 parent 42cc565 commit 2212c8e

File tree

2 files changed

+71
-69
lines changed

2 files changed

+71
-69
lines changed

CONTRIBUTING.md

+47-38
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,57 @@
1-
# Contribution or overriding
1+
# Contribution Guidelines
22

3-
Are welcome. To add a new provider just add a new Handler (which extends AbstractHandler). Then implement the chunk
4-
upload and progress.
3+
- [Pull Requests](#pull-requests)
4+
- [Adding new library](#adding-new-library)
5+
- [Your additions to your code base](#your-additions-to-your-code-base)
56

6-
1. Fork the project.
7-
2. Create your bugfix/feature branch and write your (try well-commented) code.
8-
3. Commit your changes (and your tests) and push to your branch.
9-
4. Create a new pull request against this package's `master` branch.
10-
5. **Test your code in [laravel-chunk-upload-example](https://github.com/pionl/laravel-chunk-upload-example)**.
7+
We welcome contributions to our project. If you want to add a new provider, follow these steps:
8+
9+
1. **Fork the Project:** Begin by forking the project to your own GitHub account.
10+
2. **Create a Feature Branch:** Create a new branch for your bug fix or feature implementation. Ensure your code is well-commented.
11+
3. **Commit and Push Changes:** Make your changes, including any necessary tests, and commit them to your branch. Then, push your changes to your forked repository.
12+
4. **Submit a Pull Request:** Once your changes are ready, submit a pull request to merge them into the main project's `master` branch.
13+
5. **Test Your Code:** Before submitting your pull request, ensure that your code works properly by testing it in the [laravel-chunk-upload-example](https://github.com/pionl/laravel-chunk-upload-example) project.
14+
6. **Debugging Assistance:** If you encounter any issues, consider using XDEBUG for debugging purposes.
1115

1216
## Pull Requests
1317

14-
- **Use the [PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md).**
15-
The easiest way to apply the conventions is to use `composer run lint:fix`.
18+
When submitting pull requests, please adhere to the following guidelines:
19+
20+
- **Coding Standards:** Follow the [PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md). You can easily apply these conventions using `composer run lint:fix`.
21+
22+
- **Release Cycle:** Consider our release cycle, aiming to follow [SemVer v2.0.0](http://semver.org/).
23+
24+
- **Document Changes:** Document any changes in behavior thoroughly, ensuring that the `README.md` and other relevant documentation are updated accordingly.
1625

17-
- **Consider our release cycle.** We try to follow [SemVer v2.0.0](http://semver.org/).
26+
- **Feature Branches:** Create feature branches for your pull requests rather than requesting to pull from your master branch directly.
1827

19-
- **Document any change in behaviour.** Make sure the `README.md` and any other relevant
20-
documentation are kept up-to-date.
28+
- **Single Feature per Pull Request:** Submit one pull request per feature. If you're implementing multiple features, send separate pull requests for each.
2129

22-
- **Create feature branches.** Don't ask us to pull from your master branch.
30+
Before submitting your pull request:
2331

24-
- **One pull request per feature.** If you want to do more than one thing, send multiple pull requests.
32+
1. **Rebase Changes:** Rebase your changes on the master branch to ensure a clean commit history.
33+
2. **Lint Project:** Check for any coding standard violations using `composer run lint`.
34+
3. **Run Tests:** Ensure that all tests pass by running `composer run test`.
35+
4. **Write Tests (Recommended):** If possible, write tests to cover your code changes.
36+
5. **Rebase Commits (Optional):** Consider rebasing your commits to keep them concise and relevant.
2537

26-
### Before pull-request do:
38+
Thank you for your contributions!
2739

28-
1. Rebase your changes on master branch
29-
2. Lint project `composer run lint`
30-
3. Run tests `composer run test`
31-
4. (recommended) Write tests
32-
5. (optinal) Rebase your commits to fewer commits
33-
34-
**Thank you!**
40+
# Adding new library
3541

36-
# Handler class
37-
The basic handler `AbstractHandler` allows to implement own detection of the chunk mode and file naming. Stored in the Handler namespace but you can
38-
store your handler at any namespace (you need to pass the class to the `FileReceiver` as a parameter)
42+
The `AbstractHandler` class provides a foundation for implementing custom detection of chunk mode and file naming. While it's stored in the Handler namespace by default, you can place your handler in any namespace and pass the class to the `FileReceiver` as a parameter.
3943

40-
### You must implement:
44+
### You Must Implement:
4145

42-
- `getChunkFileName()` - Returns the chunk file name for a storing the tmp file
43-
- `isFirstChunk()` - Checks if the request has first chunk
44-
- `isLastChunk()` - Checks if the current request has the last chunk
45-
- `isChunkedUpload()` - Checks if the current request is chunked upload
46-
- `getPercentageDone()` - Calculates the current uploaded percentage
46+
- `getChunkFileName()`: Returns the chunk file name for storing the temporary file.
47+
- `isFirstChunk()`: Checks if the request contains the first chunk.
48+
- `isLastChunk()`: Checks if the current request contains the last chunk.
49+
- `isChunkedUpload()`: Checks if the current request is a chunked upload.
50+
- `getPercentageDone()`: Calculates the current upload percentage.
4751

48-
### Automatic detection
49-
To enable your own detection, just overide the `canBeUsedForRequest` method
52+
### Automatic Detection
53+
54+
To enable your own detection, simply override the `canBeUsedForRequest` method:
5055

5156
```php
5257
public static function canBeUsedForRequest(Request $request)
@@ -55,8 +60,12 @@ public static function canBeUsedForRequest(Request $request)
5560
}
5661
```
5762

58-
# Fork
59-
Edit the `HandlerFactory` and add your handler to the `$handlers` array
63+
# Your additions to your code base
64+
65+
If you wish to contribute without forking, follow these steps:
66+
67+
1. **Edit HandlerFactory:** Add your handler to the `$handlers` array.
68+
69+
2. **Runtime Usage:** Call `HandlerFactory::register($name)` at runtime to register your custom Handler and utilize it.
6070

61-
# At runtime or without forking
62-
Call the `HandlerFactory::register($name)` to register your own Handler at runtime and use it
71+
Feel free to contribute and thank you for your support!

readme.md

+24-31
Original file line numberDiff line numberDiff line change
@@ -8,80 +8,73 @@
88

99
## Introduction
1010

11-
> Supports Laravel from 5.2 to 9 (covered by integration tests for 7/8/9 versions).
11+
Laravel Chunk Upload simplifies chunked uploads with support for multiple JavaScript libraries atop Laravel's file upload system, designed with a minimal memory footprint. Features include cross-domain request support, automatic cleaning, and intuitive usage.
1212

13-
Easy to use service/library for chunked upload with supporting multiple JS libraries on top of Laravel's file upload with low memory footprint in mind.
13+
For example repository with **integration tests**, visit [laravel-chunk-upload-example](https://github.com/pionl/laravel-chunk-upload-example).
1414

15-
Supports feature as [cross domains requests](https://github.com/pionl/laravel-chunk-upload/wiki/cross-domain-requests), automatic clean schedule and easy usage.
16-
17-
Example repository with **integration tests** can be found in [laravel-chunk-upload-example](https://github.com/pionl/laravel-chunk-upload-example).
18-
19-
> Before adding pull requests read CONTRIBUTION.md. Help me fix your bugs by debugging your issues using XDEBUG (and try to do a fix - it will help you become better).
15+
Before contributing, familiarize yourself with the guidelines outlined in CONTRIBUTION.md.
2016

2117
## Installation
2218

23-
**1. Install via composer**
19+
**1. Install via Composer**
2420

25-
```
21+
```bash
2622
composer require pion/laravel-chunk-upload
2723
```
2824

29-
**2. Publish the config (Optional)**
25+
**2. Publish the Configuration (Optional)**
3026

31-
```
27+
```bash
3228
php artisan vendor:publish --provider="Pion\Laravel\ChunkUpload\Providers\ChunkUploadServiceProvider"
3329
```
3430

3531
## Usage
3632

37-
Setup consists of 3 steps:
33+
The setup involves three steps:
3834

39-
1. Integrate your controller that will handle the file upload. [How to](https://github.com/pionl/laravel-chunk-upload/wiki/controller)
40-
2. Set a route for the controller. [How to](https://github.com/pionl/laravel-chunk-upload/wiki/routing)
41-
2. Choose your front-end provider below (we support multiple providers in single controller)
35+
1. Integrate your controller to handle file uploads. [Instructions](https://github.com/pionl/laravel-chunk-upload/wiki/controller)
36+
2. Define a route for the controller. [Instructions](https://github.com/pionl/laravel-chunk-upload/wiki/routing)
37+
3. Select your preferred frontend provider (multiple providers are supported in a single controller).
4238

43-
| Library | Wiki | single & chunk upload | simultaneous uploads | In [example project](https://github.com/pionl/laravel-chunk-upload-example) | Author |
44-
|---- |----|----|----| ---- | ---- |
39+
| Library | Wiki | Single & Chunk Upload | Simultaneous Uploads | Included in [Example Project](https://github.com/pionl/laravel-chunk-upload-example) | Author |
40+
|---------|------|-----------------------|----------------------|--------------------------------------------------|--------|
4541
| [resumable.js](https://github.com/23/resumable.js) | [Wiki](https://github.com/pionl/laravel-chunk-upload/wiki/resumable-js) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [@pionl](https://github.com/pionl) |
4642
| [DropZone](https://github.com/dropzone/dropzone) | [Wiki](https://github.com/pionl/laravel-chunk-upload/wiki/dropzone) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [@pionl](https://github.com/pionl) |
4743
| [jQuery-File-Upload](https://github.com/blueimp/jQuery-File-Upload) | [Wiki](https://github.com/pionl/laravel-chunk-upload/wiki/jquery-file-upload) | :heavy_check_mark: | :heavy_multiplication_x: | :heavy_check_mark: | [@pionl](https://github.com/pionl) |
4844
| [Plupload](https://github.com/moxiecode/plupload) | [Wiki](https://github.com/pionl/laravel-chunk-upload/wiki/plupload) | :heavy_check_mark: | :heavy_multiplication_x: | :heavy_multiplication_x: | [@pionl](https://github.com/pionl) |
4945
| [simple uploader](https://github.com/simple-uploader) | :heavy_multiplication_x: | :heavy_check_mark: | :heavy_multiplication_x: | :heavy_multiplication_x: | [@dyktek](https://github.com/dyktek) |
5046
| [ng-file-upload](https://github.com/danialfarid/ng-file-upload) | [Wiki](https://github.com/pionl/laravel-chunk-upload/wiki/ng-file-upload) | :heavy_check_mark: | :heavy_multiplication_x: | :heavy_multiplication_x: | [@L3o-pold](https://github.com/L3o-pold) |
5147

52-
**Simultaneous uploads:** The library must send last chunk as last, otherwise the merging will not work correctly.
48+
**Simultaneous Uploads:** The library must send the last chunk as the final one to ensure correct merging.
5349

54-
**Custom disk:** At this moment I recommend using the basic storage setup (not linking public folder). It is not tested (Have free time to ensure it is working? PR the changes!).
50+
**Custom Disk:** Currently, it's recommended to use the basic storage setup (not linking the public folder). If you have time to verify its functionality, please PR the changes!
5551

56-
For more detailed information (tips) use the [Wiki](https://github.com/pionl/laravel-chunk-upload/wiki) or for working example continue to separate repository with [example](https://github.com/pionl/laravel-chunk-upload-example).
52+
For detailed information and tips, refer to the [Wiki](https://github.com/pionl/laravel-chunk-upload/wiki) or explore a working example in a separate repository with [example](https://github.com/pionl/laravel-chunk-upload-example).
5753

5854
## Changelog
5955

60-
Can be found in [releases](https://github.com/pionl/laravel-chunk-upload/releases).
56+
View the changelog in [releases](https://github.com/pionl/laravel-chunk-upload/releases).
6157

62-
## Contribution or extending
58+
## Contribution or Extension
6359

64-
> Read contribution before your PR (and use example repository to run integration tests).
60+
Review the contribution guidelines before submitting your PRs (and utilize the example repository for running integration tests).
6561

66-
See [CONTRIBUTING.md](CONTRIBUTING.md) for how to contribute changes. All contributions are welcome.
62+
Refer to [CONTRIBUTING.md](CONTRIBUTING.md) for contribution instructions. All contributions are welcome.
6763

6864
## Compatibility
6965

70-
> Laravel 5/6 should be still supported but we are not testing them via automation sccripts
66+
Though not tested via automation scripts, Laravel 5/6 should still be supported.
7167

7268
| Version | PHP |
7369
|---------|---------------|
70+
| 11.* | 8.2 |
7471
| 10.* | 8.1, 8.2 |
7572
| 9.* | 8.0, 8.1 |
7673
| 8.* | 7.4, 8.0, 8.1 |
7774
| 7.* | 7.4 |
7875

79-
80-
8176
## Copyright and License
8277

83-
[laravel-chunk-upload](https://github.com/pionl/laravel-chunk-upload)
84-
was written by [Martin Kluska](http://kluska.cz) and is released under the
85-
[MIT License](LICENSE.md).
78+
[laravel-chunk-upload](https://github.com/pionl/laravel-chunk-upload) was authored by [Martin Kluska](http://kluska.cz) and is released under the [MIT License](LICENSE.md).
8679

87-
Copyright (c) 2016 and beyond Martin Kluska
80+
Copyright (c) 2017 and beyond Martin Kluska and all contributors (Thank you ❤️)

0 commit comments

Comments
 (0)