Download the PHP package floppy/client without Composer

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

FloppyClient

Build Status

FloppyClient is a client for FloppyServer library. Before using this library you should install you instance of FloppyServer. How to use FloppyServer you can find in documentation.

FloppyClient provides two simple integration points:

FloppyClient is a pure client for FloppyServer, if you want to use Floppy in Symfony2 app you should be interested in FloppyBundle.

Documentation

ToC

Features

FloppyClient and FloppyServer combo provides simple to use file storage server. Thanks to Floppy you won't care about write code to upload and storage files, code to generate (on runtime or pre-store) various thumbnails for photos, code to optimize your files etc. Application that you develop should only know where to upload file, from where the requested file variant can be retrieve and eventually know security rules and credentials that should be provided.

StorageServer's responsibility is to store files in efficient way (on filesystem by default, but it can be for example on cloud) and transparently preparing requested file variant - for example thumbnail in given sizes.

Usage example

Configuration

Fundamental FloppyClient configuration options:

Security credentials generator

You can define security rules to upload or download file from Floppy. Class that is responsible to add credentials to upload or download request is Floppy\Client\Security\CredentialsGenerator. You can pass credentials to UrlGenerator::generate or FloppyClient::upload methods.

Default CredentialsGenerator implementation is PolicyGenerator, that cooporates with Floppy\Server\RequestHandler\Security\PolicyRule from FloppyServer library. Supported credential attributes:

You can change implementation of CredentialsGenerator by passing your own implementation to Factory credentialsGenerator attribute. If you want to change credentials generator you should remember to change action.download.securityRule and action.upload.securityRule in your instance of FloppyServer too.

File handlers (file types)

There are two file handlers by default: image and file (other files). File handler on client side are important only for url generator - generator should know for what file type generate url. Url generator recognize file types by extensions. By default file is image when has given extensions: png, jpg, jpeg or gif. Files with other extensions have "file" type. You can customize image extensions by passing urlGenerator.image.extensions attribute to Factory. You should remember that file handlers in client side should be configured as same as on server side (you should configure fileHandlers.image.extensions, fileHandlers.image.mimeTypes, fileHandlers.file.extensions, fileHandlers.file.mimeTypes attributes in your instance of FloppyServer). Example FloppyClient configuration:

Detailed usage

Create Floppy factory object example:

Url generator

You can create UrlGenerator using factory:

UrlGenerator has one method: UrlGenerator::generate(FileId $fileId, $fileType = null, array $credentialAttributes = array()). First argument is FileId to what url you want to generate. Second argument is file type (it is not mime type, it is name of FileHandler that should be used for this file). By default file type will be guessed depends on file extension, but you are able to enforce file type. Third argument is credential attributes. More info about credential attributes you can find in Security credentials generator section.

As first argument you can pass FileId to original file or to proper file variant (for example thumbnail in given sizes). The thumbnail with size 60x60 can be generated in this way:

For images there are available bunch of filters as same as in LiipImagineBundle library:

Supported attributes for file file type:

File uploading

You can create FloppyClient using factory:

FloppyClient has one method: FloppyClient::upload(FileSource $fileSource, array $credentialAttributes = array()). Instance of FileSource you can create using factory method FileSource::fromFile(\SplFileInfo $file) or directly by constructor.

Second parameter of upload method is credential attributes - more about it is on Security credentials generator section.

Return type of upload method is Floppy\Common\FileId. On failure Floppy\Client\Exception\IOException is thrown. FileId returned by upload method contains extra info about uploaded file:

This extra info is accessible by FileId::info() method. FileId has id attribute accessible by method FileId::id() - this value you should store somewhere (database?) to be able to generate url to this file in the future.

License

This project is under MIT license.


All versions of client with dependencies

PHP Build Version
Package Version
Requires kriswallsmith/buzz Version >=v0.10
floppy/common Version >=0.1.0,<0.2.0
pimple/pimple Version 2.0.*
jbroadway/urlify Version >=1.0.0,<1.1.0
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 floppy/client contains the following files

Loading the files please wait ....