Download the PHP package yassinedabbous/laravel-file-cast without Composer

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

Laravel File Cast

Easily link your uploads with their table columns

Table of Content


:sparkles: Features


:small_red_triangle_down: Installation

composer require yassinedabbous/laravel-file-cast


:technologist: Usage

Just cast any of your table columns with FileCast::class like that:

This will cast the avatar column.

For Old Laravel Versions (< 11.x):

If for any reason you want to customize the disk with a dynamic value, you should modify your model with a public method that returns an array containing the disk name for each column:


:card_file_box: Supported data formats

• Uploaded file:

Assuming your request form has a file/image named "avatar", you can assign the file to it's column:

Or even fill the model with request input:

It accept any type of file, so you can do that also:

• Local file path:

• Remote file url:

• Base64 URI:

• JSON string:

• Array as JSON or CSV:

• NULL ?

Null value will cause automatic file deletion (configurable):

It has never been easier!



:hammer_and_wrench: Functionalities:

To provide more functionalities to file caster, this package uses a wrapper class name FileField, this class works as a proxy to the Storage facade with some additional methods.

• Storage Proxy

As a proxy to the Laravel Storage facade, you can call any method from Storage directly on the file field without providing the file path:


• Additional Methods

In addition to Storage methods, FileField comes with some useful methods:


• File Manipulation

Old files are cleaned automatically when column value updated.

To automatically delete old files on Model deleted event, add HasFileCast trait to your model.

To delete files manually:





• Extending

File Cast is "macroable", which allows you to add additional methods to FileField class at run time. The FileField class' macro method accepts a closure that will be executed when your macro is called. The macro closure may access the FileField's other methods via $this, just as if it were a real method of the FileField class. For example, the following code adds a resize method to the FileField class:



:gear: Configuration

You can optionally publish the config file with:

php artisan vendor:publish --tag=file-cast-config

These are the contents of the default config file that will be published:


All versions of laravel-file-cast with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
guzzlehttp/guzzle Version ^7.5
laravel/framework Version >=9.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 yassinedabbous/laravel-file-cast contains the following files

Loading the files please wait ....