Download the PHP package bmartel/phperclip without Composer

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

Phperclip

File upload management boilerplate got you down? Do you want to simplify the process of modifying and caching originally uploaded files? Phperclip is a package designed to ease management of file storage, order and manipulation.

Features:

Setup

To get Phperclip ready for use in your project, take the usual steps for setting up a Laravel 4 pacakge.

Configuration

File Name Generation

File names are generated using an injected class which implements Bmartel\Phperclip\Contracts\FileNameGenerator. By default, Phperclip uses its own implementation of the file name generator Bmartel\Phperclip\FileNameGenerator. It is set in the config as:

This implementation takes an md5 hash of the json result of the files options and attributes. If you wish to generate the filename using other means, create your own implementation, and include the class as the value of filename_generator in Phperclip's config.php file.

Storage

If you open the copy of config.php that was created during setup, you will see it is already populated with configuration options for the most typical of setups. The Bmartel\Phperclip\Storage\Filesystem driver is the most basic which simply stores image files in your site's public directory.

Amazon S3 Driver

Replace the filesystem driver configuration in the 'config.php' file with the Amazon AWS configuration below.

Processors

Phperclip doesn't dictate what you want to do with your files. Instead it provides hooks into the service lifecycle methods via FileProcessors. FileProcessors allow you to specify the file types it will be responsible for, and the lifecycle methods: onBeforeSave, onSave, onDelete, and onMove allow you to perform any processing on the file you wish.

The following lifecycle methods will abort the current operation if a false type is returned from them. The normal run condition of the methods expect you to return the file which was passed in.

An included ImageProcessor has been provided as both a showcase the power of the FileProcessor components, as well as to provide flexibile and chainable Image filtering!

Image Filters

Phperclip's filtering chains are a powerful feature that allow you to orchestrate arbitrary combinations of manipulations when saving or retrieving images. When processing a chain, Phperclip does the following for each filter in the chain:

You will most likely want to pre-configure filter chains for your project so that you don't have to repeat them over the course of retrieving variations. Phperclip uses a simple array schema to define filtering chains. Here's a sample of one:

If you're unsure as to where you should store your filter profiles, it's suggested that you place them in the filters.php file that has also been created for you when you published Phperclip's configuration earlier. This will allow you to vary the filter configurations along with your environments and will make retrieval as simple as Config::get('phperclip::filters.filter_name')

Usage

Depending on the nature of your implementation, the means by which you will receive files will vary. Phperclip makes no assumptions about your request lifecycle (or that there's even a request at all!) and only concerns itself with recieving instances of Symfony\Component\HttpFoundation\File\File.

The two optional, secondary pieces of information that Phperclip makes use of are Clippable to scope to a specific model and an options array which allow for processing to take place on the file.

Trait

If you plan on attaching files to a model (User, Item, ImageGallery), that model must implement the interface Bmartel\Phperclip\Model\Clippable. This will mandate a method that you can either implement yourself or conveniently keep in sync with Phperclip by using the trait Bmartel\Phperclip\Model\ClippableImpl.

Saving

Saving files is done via the Phperclip service which can either be accessed via the facade or through dependency injection.

Phperclip will return an instance of Bmartel\Phperclip\Model\File upon a successful save. If you supplied one, the file record will be associated with a clippable. Any additional attributes will be passed through to the save as well via the attributes key of the options array.

Retrieval

When retrieving an individual file, you will need a way to identify it:

Most of the time you will have at least one of these three pieces of information which will then allow you to obtain a URI to the physical file.

You can also retrieve a collection of files, optionally by the clippable it belongs to, file mimetype, or slot. Phperclip will return a collection of Bmartel\Phperclip\Model\File.

When retrieving files from Phperclip, it's helpful to remember that anywhere you see "clippable" is optional and omitting it or providing null means "global". Similarly, "options" is also optional and omitting this value, providing null or an empty array will mean "the original file".

Slots

Phperclip features a concept known as slots which at it's very core is just a string value. Slots are used to order and/or key files by their clippable. There are helper scopes on the Bmartel\Phperclip\Model\File class to help with retrieving files based on their slot values.

A sample use case for slots would be an "Item" class that can have an image gallery as well as a "primary" image. Images belonging to the gallery would have slots that are numeric so that they can be kept in a specific order while the primary image is in a named slot that can be queried directly.

Batches

It's common for implementations to require a way to submit multiple changes to a clippable's files in a single pass. These changes can sometimes present conflicts and be challenging to resolve.

As a convenience, Phperclip supplies a batch method off the service that allows these bulk operations to be performed. The operations are scoped by clippable and performed slot-by-slot in a safe order.

The structure of the schema is caller agnostic and in the unavoidable case of a conflict will null-out the slot of any files being displaced.

Here's a sample of the schema used when performing batch operations:

In this example, the following actions would be taken - in order:

The file array $newFiles will be keyed by slot and could in theory contain new a new file for slot 4.

When a file is told to move to a new slot, if there is one aready in the target slot, they are swapped. If an uploaded file attempts to go into an already-occupied slot, the file currently in the slot will have it's slot nulled out.

It's important to note that slot keys cannot be duplicated in this schema, so it's in your best interest to submit the simplest batch list possible.

Drivers

Creating a driver is as simple as extending the class Bmartel\Phperclip\Storage\Base. You can also use Bmartel\Phperclip\Storage\Filesystem as a reference.

Processors

To make the magic happen with files, you will want to implement a dedicated FileProcessor to handle tasks which may need to happen during the lifecycle of the file service. You specify in the class which file mimetypes the processor will execute for, and provide the processing in the life cycle methods as appropriate for your own requirements.

To begin, implement the interface Bmartel\Phperclip\Contracts\FileProcessor. For some free extras like a built in file validation and flash messaging, instead extend the class Bmartel\Phperclip\Processes\FileProcessorAdapter.

The Image Filters are actually handled via an included FileProcessor Bmartel\Phperclip\Processes\ImageProcessor! You can use that as a guideline when creating your own FileProcessors.

Image Filters

It's very easy to create your own image filters within your own project or packages. Just implement the interface Bmartel\Phperclip\Contracts\Filter.

The only rule is that filter subclasses must perform their manipulations to the file provided without moving, renaming or deleting it - overwriting is fine. The run method is not expected to return a value.

See Bmartel\Phperclip\Processes\Image\Resize and Bmartel\Phperclip\Processes\Image\FixRotation as guidelines when creating your own image filters.

Issues

If you encounter any issues, find a bug or have any questions, feel free to open a ticket in the issue tracker.

Credits

Brandon Martel - Maintainer

Alex Trauzzi - created original implementation of tippingcanoe/imager, of which this package based on.


All versions of phperclip with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
aws/aws-sdk-php Version 2.5.*
illuminate/http Version 5.*
illuminate/database Version 5.*
illuminate/config Version 5.*
intervention/image Version 2.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 bmartel/phperclip contains the following files

Loading the files please wait ....