Download the PHP package aniftyco/laravel-attachments without Composer

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

Attachments for Laravel

Turn any field on your Eloquent models into attachments with automatic file management and cleanup.

Latest Version on Packagist Total Downloads

Features

Requirements

Installation

You can install the package via Composer:

Publish the configuration file (optional):

Usage

Migrations

Add attachment columns to your migrations using the provided Blueprint macros:

The attachment() and attachments() macros automatically create nullable JSON columns for storing attachment data.

Adding Attachments to Models

To add attachments to your Eloquent models, use the provided cast classes.

Single Attachment

Use the AsAttachment cast to handle a single attachment:

To set an image as an attachment on your model:

Multiple Attachments

Use the AsAttachments cast to handle multiple attachments:

To attach multiple attachments to your model:

Working with Attachments

Accessing Attachment Properties

Generating URLs

File Operations

Working with Multiple Attachments

Automatic File Cleanup

The package provides automatic file cleanup when models are deleted or attachments are replaced.

Model Deletion Cleanup

To enable automatic cleanup when a model is deleted, add the HasAttachmentCleanup trait to your model:

Now when you delete a user, their avatar file will be automatically deleted:

Replacement Cleanup

By default, when you replace an attachment with a new one, the old file is automatically deleted:

Disabling Automatic Cleanup

You can disable automatic cleanup globally in the configuration file:

Configuration

The package comes with sensible defaults, but you can customize the behavior by publishing and editing the configuration file:

Available configuration options:

Testing

Run the test suite:

Run code style checks:

Fix code style issues:

Contributing

Thank you for considering contributing to the Attachments for Laravel package! You can read the contribution guide here.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-attachments with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/http Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.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 aniftyco/laravel-attachments contains the following files

Loading the files please wait ...