Download the PHP package ernestmarcinko/waifuvault-php-api without Composer

On this page you can find all versions of the php package ernestmarcinko/waifuvault-php-api. 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 waifuvault-php-api

waifuvault-php-api

tests

This contains the official API bindings for uploading, deleting and obtaining files with waifuvault.moe. Contains a full up-to-date API for interacting with the service via PHP

Installation via Composer

Usage

This API contains 4 interactions:

  1. Upload File
  2. Get File Info
  3. Delete File
  4. Get File
  5. Modify Entry

The only class needed is the WaifuApi class from ErnestMarcinko\WaifuVault:

Upload File

To Upload a file, use the WaifuApi::uploadFile function.

Parameters

The function accepts an associative array of arguments.

Param (key) Type Description Required Extra info
file string The file path to upload true only if url or file_contents is not supplied If url is supplied, this prop can't be set
url string The URL to a file that exists on the internet true only if file or file_contents is not supplied If url is supplied, this prop has no effect
file_contents string The file contents true only if url or file is not supplied If url or file is supplied, this prop can't be set
expires string A string containing a number and a unit (1d = 1day) false Valid units are m, h and d
hideFilename boolean If true, then the uploaded filename won't appear in the URL false Defaults to false
password string If set, then the uploaded file will be encrypted false
filename string Only used if file_contents or file is set, will set the filename of the upload false
oneTimeDownload boolean If true, the file is deleted after the first access false

WaifuResponse Return value

The function returns a WaifuResponse object, throws and Exception or WaifuException. Almost all SDK functions will use this object as their return values.

Examples

Using a URL:

Using a file path:

Using a file contents:

Get File Info

The WaifuApi::getFileInfo function is used to get the file information.

Parameters

Param Type Description Required Extra info
token string The token of the upload true
formatted boolean If you want the retentionPeriod to be human-readable or an epoch false defaults to false

Return value

WaifuApi::getFileInfo returns a WaifuResponse

Examples

Human-readable timestamp retention period:

Delete File

The WaifuApi::deleteEntry function is used to get the file information.

Parameters

Param Type Description Required Extra info
token string The token of the file you wish to delete true

Return values

NOTE: deleteFile will only ever either return true or throw an exception if the token is invalid

Examples

Get File

The WaifuApi::getFile function is used to get the file contents from the server by supplying either the token or the unique identifier of the file (epoch/filename).

Parameters

The function accepts an associative array of arguments.

Param (key) Type Description Required Extra info
token string The token of the file you want to download true only if filename is not set if filename is set, then this can not be used
filename string The Unique identifier of the file, this is the epoch time stamp it was uploaded and the filename true only if token is not set if token is set, then this can not be used
password string The password for the file if it is protected false Must be supplied if the file is uploaded with password

Important! The Unique identifier filename is the epoch/filename only if the file uploaded did not have a hidden filename, if it did, then it's just the epoch. For example: 1710111505084/08.png is the Unique identifier for a standard upload of a file called 08.png, if this was uploaded with hidden filename, then it would be 1710111505084.png

Return value

The function returns the file contents.

Examples

Obtain an encrypted file

Obtain a file from Unique identifier

Modify Entry

The WaifuApi::modifyEntry is used to modify aspects of your entry such as password, removing password, decrypting the file, encrypting the file, changing the expiry, etc.

Parameters

The function accepts an associative array of arguments.

Option Type Description Required Extra info
token string The token of the file you want to modify true
password string The new password or the password you want to use to encrypt the file false
previousPassword string If the file is currently protected or encrpyted and you want to change it, use this for the old password true only if password is set and the file is currently protected if the file is protected already and you want to change the password, this MUST be set
customExpiry string a new custom expiry, see expires in uploadFile false
hideFilename boolean make the filename hidden false for the new URL, check the response URL prop

Return value

WaifuApi::getFileInfo returns a WaifuResponse

Examples

Set a password on a non-encrypted file:

Change a password:

change expire:

decrypt a file and remove the password:

Custom Request Handler

The WaifuApi object can be instantiated with a custom RequestHandler (implementing RequestHandler interface). The built in request handler uses CURL.

Default Request Handler

When isntantiating the class without any parameters the default request handler is used.

Making your custom request handler

If you prefer your own methods to handle requests, you can create your own class and pass it on to the WaifuApi constructor. The class must implement the ErnestMarcinko\WaifuVault\RequestHandler interface.

Then use it via DI:

WaifuVault SDKs for other languages


All versions of waifuvault-php-api with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
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 ernestmarcinko/waifuvault-php-api contains the following files

Loading the files please wait ....