Download the PHP package sowrensen/wormhole without Composer

On this page you can find all versions of the php package sowrensen/wormhole. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wormhole

Wormhole

Plug and play file uploader for Laravel applications.

Wormhole is a package for Laravel applications that provides a couple of methods which can be used to upload file and store them to different location in server. Make no mistake, Laravel itself provides very convenient way to upload file, and this package is using nothing but Laravel's Storage class under the hood. The difference is, methods provided here can be used for multiple purposes. I find myself copying and pasting same code on all of my projects and so I thought to put these methods in a package. Nothing fancy!

Plus, there is a Vue component included with progress bar to show file uploading progress and with configurable front-end validation, which can be published if anyone wants.

Installation

To install the package run,

Usage

There are three methods provided in this package.

1. saveFile

Use this method to store any binary file. It takes one mandatory and two optional parameters. After successful operation, an auto-generated file name will be returned, you should store this for future use.

Parameter Type Required Default Description
$file \Illuminate\Http\UploadedFile Yes The file to be uploaded, like, $request->file('file').
$directory string No files The directory name in which the file should be stored.
$disk string No public The Laravel disk name in which the file should be stored.
Returns

The auto-generated file name.

Example

2. saveBase64File

Use this method to store any Base64 encoded file. An example use case of Base64 encoded file when you resize and crop an image in a canvas before uploading. The second and third parameters are same as saveFile method. After successful operation, an auto-generated file name will be returned, you should store this for future use.

Parameter Type Required Default Description
$data string Yes Base64 string, pass like $request->input('file').
$directory string No files The directory name in which the file should be stored.
$disk string No public The Laravel disk name in which the file should be stored.
Returns

The auto-generated file name.

Example

3. deleteFile

This method takes one mandatory parameter and one optional parameter.

Parameter Type Required Default Description
$filename string Yes Name of the file to be removed (Required)
$directory string No files Name of the directory where the file resides.
$disk string No public The Laravel disk name in which the file is stored.
Returns

true or false depending on operation status.

Example

Vue Component

A vue component is provided along with this package which can be used as an interactive input field for uploading large files. The component is provided in two presets, one for Bootstrap and the other for UIKit. The bootstrap version requires jQuery to work while the UIKit version requires the uikit library. However, these are entirely non-compulsory. To use the component, publish the resources by running:

FileUploader.vue file will be placed at resources/js/components directory of your Laravel application. You have to import the component to your app.js file. Afterward, you can use it in blade files or other vue components,

The Vue component has seven props and among them only one is mandatory to specify.

Parameter Type Required Default Description
url string Yes The route to send a post request to your app
input-label string No Label of your input field. It won't be shown unless you set it explicitly.
input-placeholder string No 'Choose file' Placeholder which will be shown upon file input element.
supported-formats array No null Defines which type of files are supported. If you set supported formats, the file format will be validated during selection. Also a helper text related to supported formats will be shown under the input element.
max-size integer No null Maximum size of selected file in megabyte. If you set the max size property, file size will be validated during selection. Also a helper text related to size will be shown under the input element.
field-name string No 'file' Once the file is uploaded, a hidden input element will hold the returned name of the file as value so that you can save it in database. This property defines the name of that input element.
wait integer No 5 Defines how long the uploader should wait before starting the upload. This waiting time gives user an opportunity to abort the upload and reselect the file.
notification-position string No 'top-right' Only applicable for UIKit component. Defines the position of the notification pop-up. See available options here.

Samples

UIKit Component

Bootstrap Component


All versions of wormhole with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
laravel/framework Version >=5.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sowrensen/wormhole contains the following files

Loading the files please wait ....