This example covers all supported versions of Laravel. This implementation allows testing across all versions simultaneously.
This repository contains a full example for the laravel-chunk-upload package. You can either explore an example app or run tests against all supported versions of Laravel.
git clone [email protected]:pionl/laravel-chunk-upload-example.git --recurse-submodules
npm install
- PHP Installed if running locally
- Node.js
- Docker and Docker Compose installed
To install and run a specific version of Laravel, use the X.* version format.
node run.js "8.*"
Pass --ignore-example to ignore updating and building the example.
Pass --verbose for debug information.
The current version of laravel-chunk-upload is tested against:
Laravel | PHP | Run | Tests |
---|---|---|---|
10.* | 8.2-node-20, 8.2-node-20 | node run "11.*" |
node tests.js "11.*" |
10.* | 8.1-node-17, 8.2-node-18 | node run "10.*" |
node tests.js "10.*" |
9.* | 8.0-node-17, 8.1-node-17, 8.2-node-18 | node run "9.*" |
node tests.js "9.*" |
8.* | 7.4-node-17, 8.0-node-17, 8.1-node-17 | node run "8.*" |
node tests.js "8.*" |
7.* | 7.4-node-17 | node run "7.*" |
node tests.js "7.*" |
Pass --verbose for debug information.
Run tests on all Laravel versions (install them before using it) using docker
node tests.js
Run tests on a desired Laravel version
node tests.js "8.*"
- In one terminal, run
php 7.\*/artisan serve --host=0.0.0.0 --port=8000
. - In a second terminal, run tests with
./node_modules/.bin/codeceptjs run --steps
. npm run test-debug
will show the browser while tests are running.
- Environment variables should be passed:
IMAGE_VERSION
(PHP version) andLARAVEL_VERSION
. abort-on-container-exit
needs to be used to stop the Laravel server.
IMAGE_VERSION=7.4 LARAVEL_VERSION=8.\* docker-compose -f docker-compose.yml -f docker-compose-tests.yml up --abort-on-container-exit
Do not commit your changes - use a pull request in the main repo.
- Replace the
laravel-chunk-upload
folder with your repository (clone your fork). - Or you can pull changes from your fork with with given bash script:
pr.sh <your-github-username> <branch = default is master> <repository-name = laravel-chunk-upload>
- Run tests on all versions with
node tests.js
to ensure backward compatibility.
- Docker and Docker Compose installed.
- Node.js installed.
Do not commit your changes - use a pull request in the main repo.
- Add a new version to the
versions.json
file. - Add your changes to the
laravel-chunk-upload
folder. - Test the Laravel version with
node tests.js "10.\*"
. - Run tests on all versions with
node tests.js
to ensure backward compatibility.
- Controller - Dynamic Usage at ./example/src/Http/Controllers/UploadController.php
- Views at ./example/resources/views/example/ - Here, you can find a basic layout for the providers.
- JavaScript at ./example/resources/assets/js/ - Here, you can find the initial setup for the providers.
- It is recommended to upload the file in a separate queue JOB. Uploading can take time (for large files), and the request could get timed out.
- It is important to stream the file to the cloud (not using
file_get_contents
), which would consume your memory. - Also, don't forget to remove the uploaded file after the upload.
Example code found at ./example/src/Http/Controllers/UploadController.php.
- If you make changes in assets, do not forget to call
node compile.js
to compile the changes and publish them to all versions (you can also pass the desired version).
- Improve example controller.
- Add tests to Dropzone.
- Clean storage after tests.
- Add tests for parallel save.
I did not find a way to install Laravel on master with the latest changes from the framework. Let me know if you know how.
laravel-chunk-upload-example was written by Martin Kluska and is released under the MIT License.
Copyright (c) 2017 and beyond Martin Kluska and all the contributors (Thank you ❤️)