GitHub RepositoryOpen SourceMITLaravelPHPDemo AvailableExternal Project

spatie/laravel-medialibrary

This is an external open-source GitHub repository imported into the WOCSOL Marketplace for discovery. The original repository owner is the primary creator.

Stars
6.1K
Forks
1.1K
Watchers
6.1K
Open Issues
2
spatie/laravel-medialibrary

Repository Details

Repository
spatie/laravel-medialibrary
Framework
Laravel
Primary Language
PHP
Content Language
English
License
MIT
Stars
6.1K
Forks
1.1K
Watchers
6.1K
Open Issues
2
Default Branch
main
Last Synced
25 Jun 2026
Repository Status
draft_created

Repository Description

AI Summary

Associate files with Eloquent models

Original Repository Description

Associate files with Eloquent models

README Preview

<div align="left"> <a href="https://spatie.be/open-source?utm_source=github&utm_medium=banner&utm_campaign=laravel-medialibrary"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://spatie.be/packages/header/laravel-medialibrary/html/dark.webp"> <img alt="Logo for laravel-medialibrary" src="https://spatie.be/packages/header/laravel-medialibrary/html/light.webp"> </picture> </a> <h1>Associate files with Eloquent models</h1> [![Latest Version](https://img.shields.io/github/release/spatie/laravel-medialibrary.svg?style=flat-square)](https://github.com/spatie/laravel-medialibrary/releases) [![run-tests](https://github.com/spatie/laravel-medialibrary/actions/workflows/run-tests.yml/badge.svg)](https://github.com/spatie/laravel-medialibrary/actions/workflows/run-tests.yml) [![Total Downloads](https://img.shields.io/packagist/dt/spatie/laravel-medialibrary.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-medialibrary) </div> This package can associate all sorts of files with Eloquent models. It provides a simple API to work with. To learn all about it, head over to [the extensive documentation](https://spatie.be/docs/laravel-medialibrary). Here are a few short examples of what you can do: ```php $newsItem = News::find(1); $newsItem->addMedia($pathToFile)->toMediaCollection('images'); ``` It can handle your uploads directly: ```php $newsItem->addMedia($request->file('image'))->toMediaCollection('images'); ``` Want to store some large files on another filesystem? No problem: ```php $newsItem->addMedia($smallFile)->toMediaCollection('downloads', 'local'); $newsItem->addMedia($bigFile)->toMediaCollection('downloads', 's3'); ``` The storage of the files is handled by [Laravel's Filesystem](https://laravel.com/docs/filesystem), so you can use

LaravelPHPMITeloquentmediauploadimageshacktoberfest

Related Repositories

Product Discussion

Ask questions or discuss this product. New comments are reviewed before publishing.

0 comments

Loading comments...

Explore

WOCSOL services and marketplace

Account

Sign in or create an account to manage downloads, orders, and support.