Download the PHP package teamteatime/laravel-filer without Composer

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

Please be aware that this package is not designed to handle uploading or image manipulation. It's simply designed to compliment other packages and tools that already exist in Laravel. If you're looking for a more feature-complete attachments solution, take a look at CodeSleeve/stapler.

Installation

Step 1: Install the package

Install the package via Composer:

Add the service provider to your config/app.php:

If your app defines a catch-all route, make sure you load this service provider before your app service providers.

Step 2: Publish the package files

Run the vendor:publish command to publish Filer's migrations:

php artisan vendor:publish

Step 3: Update your database

Run your migrations:

php artisan migrate

Step 4: Update your models

Add attachment support to your models by using the HasAttachments trait:

Configuration

Filer requires no configuration out of the box in most cases, but the following options are available to you in config/filer.php:

Option Type Description Default
routes Boolean Determines whether or not to automatically define filer's routes. If you set this to false, you can optionally use \TeamTeaTime\Filer\Filer::routes($router, $namespace) in your routes.php. true
route_prefix string If routes are enabled, this is used for all route prefixes. files
hash_routes Boolean Enables unique hashes for local files to obfuscate their IDs in routes. false
hash_length string The length to use when generating hashes for local files. 40
path Array Contains the relative and absolute paths to the directory where your attachment files are stored. storage_path('uploads')
append_querystring Boolean If enabled, attachment URLs include a querystring containing the attachment's updated_at timestamp. This prevents out of date attachments from being loaded by the browser. true
cleanup_on_delete Boolean If enabled, Filer will attempt to delete local files referenced by deleted attachments. true

Usage

To attach a file or URL, use the attach() method on your model. This method will accept any of the following:

...a local file path

...an instance of SplFileInfo

Symfony\Component\HttpFoundation\File\File, Symfony\Component\HttpFoundation\File\UploadedFile and Illuminate\Http\UploadedFile are extensions of SplFileInfo and Laravel Requests contain the latter by default.

...or a URL

You can also specify a key (which uniquely identifies the attachment), a title, and/or a description using the options array:

By default, attachments are associated with user IDs using Auth::id(). You can override this at call time:

Depending on what you pass to this method, the item will be stored as either a TeamTeaTime\Filer\LocalFile or a TeamTeaTime\Filer\Url. You can later call on attachments via the attachments relationship. Examples are provided below.

Displaying a list of attachments in a view

Retrieving an attachment by ID or key

Accessing an attachment's properties and type-specific properties

Generating URLs

The getUrl() and getDownloadUrl() methods above will return different values based on the attachment type; if it's a local file, they will return the 'view' and 'download' routes respectively, otherwise they'll return the URL that was attached.

For local files, the provided routes can be generated with a file ID or hash:

Note that depending on the file's MIME type, the browser may begin a download with both of these routes.


All versions of laravel-filer with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.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 teamteatime/laravel-filer contains the following files

Loading the files please wait ....